This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun startScans() { | |
BluetoothAdapter | |
.getDefaultAdapter() | |
.bluetoothLeScanner | |
.startScan( | |
object : ScanCallback() { | |
override fun onScanFailed(errorCode: Int) { | |
// todo handle scan failure | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-10-25 18:46:08.398 3037-18057/? D/HostEmulationManager: notifyHostEmulationActivated | |
2019-10-25 18:46:08.401 3037-18057/? D/HostEmulationManager: notifyHostEmulationData | |
2019-10-25 18:46:08.402 3037-18057/? D/HostEmulationManager: Service already bound as regular service. | |
2019-10-25 18:46:08.402 3037-18057/? D/HostEmulationManager: Waiting for new service. | |
2019-10-25 18:46:09.184 3037-18057/? D/HostEmulationManager: notifyHostEmulationDeactivated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-10-25 19:19:31.587 3046-3506/? D/HostEmulationManager: notifyHostEmulationActivated | |
2019-10-25 19:19:31.588 3046-3506/? D/HostEmulationManager: notifyHostEmulationData | |
2019-10-25 19:19:31.588 3046-3506/? D/HostEmulationManager: Binding to service ComponentInfo{service name omitted} | |
2019-10-25 19:19:31.592 3046-3506/? D/HostEmulationManager: Waiting for new service. | |
2019-10-25 19:19:31.605 3046-3046/? D/HostEmulationManager: Service bound | |
2019-10-25 19:19:31.610 3046-3046/? D/HostEmulationManager: Sending data | |
2019-10-25 19:19:31.654 3046-3506/? D/HostEmulationManager: notifyHostEmulationData | |
2019-10-25 19:19:31.658 3046-3046/? D/HostEmulationManager: Sending data | |
2019-10-25 19:19:31.685 3046-3506/? D/HostEmulationManager: notifyHostEmulationData | |
2019-10-25 19:19:31.697 3046-3046/? D/HostEmulationManager: Sending data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nullable | |
protected String createStackElementTag(@NotNull StackTraceElement element) { | |
String tag = element.getClassName(); | |
Matcher m = ANONYMOUS_CLASS.matcher(tag); | |
if (m.find()) { | |
tag = m.replaceAll(""); | |
} | |
tag = tag.substring(tag.lastIndexOf('.') + 1); | |
// Tag length limit was removed in API 24. | |
if (tag.length() <= MAX_TAG_LENGTH || Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override final String getTag() { | |
String tag = super.getTag(); | |
if (tag != null) { | |
return tag; | |
} | |
// DO NOT switch this to Thread.getCurrentThread().getStackTrace(). The test will pass | |
// because Robolectric runs them on the JVM but on Android the elements are different. | |
StackTraceElement[] stackTrace = new Throwable().getStackTrace(); | |
if (stackTrace.length <= CALL_STACK_INDEX) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Set a one-time tag for use on the next logging call. */ | |
@NotNull | |
public static Tree tag(String tag) { | |
Tree[] forest = forestAsArray; | |
//noinspection ForLoopReplaceableByForEach | |
for (int i = 0, count = forest.length; i < count; i++) { | |
forest[i].explicitTag.set(tag); | |
} | |
return TREE_OF_SOULS; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nullable | |
String getTag() { | |
String tag = explicitTag.get(); | |
if (tag != null) { | |
explicitTag.remove(); | |
} | |
return tag; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void prepareLog(int priority, Throwable t, String message, Object... args) { | |
// Consume tag even when message is not loggable so that next message is correctly tagged. | |
String tag = getTag(); | |
if (!isLoggable(tag, priority)) { | |
return; | |
} | |
// some code omitted for brevity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Log a debug message with optional format args. */ | |
public void d(String message, Object... args) { | |
prepareLog(Log.DEBUG, null, message, args); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aga.android.viewbindingtest | |
import android.os.Bundle | |
import android.widget.Button | |
import android.widget.ImageView | |
import android.widget.TextView | |
import androidx.appcompat.app.AppCompatActivity | |
import butterknife.BindView | |
import butterknife.ButterKnife |