use of android.os.MessageQueue.IdleHandler in project android_frameworks_base by ResurrectionRemix.
the class BaseActivity method addListenerForLaunchCompletion.
/**
* Closes the activity when it's idle.
*/
private void addListenerForLaunchCompletion() {
addEventListener(new EventListener() {
@Override
public void onDirectoryNavigated(Uri uri) {
}
@Override
public void onDirectoryLoaded(Uri uri) {
removeEventListener(this);
getMainLooper().getQueue().addIdleHandler(new IdleHandler() {
@Override
public boolean queueIdle() {
// close the activity once idle, and notify the testing activity.
if (getIntent().getBooleanExtra(EXTRA_BENCHMARK, false) && BENCHMARK_TESTING_PACKAGE.equals(getCallingPackage())) {
setResult(RESULT_OK);
finish();
}
Metrics.logStartupMs(BaseActivity.this, (int) (new Date().getTime() - mStartTime));
// Remove the idle handler.
return false;
}
});
new Handler().post(new Runnable() {
@Override
public void run() {
}
});
}
});
}
use of android.os.MessageQueue.IdleHandler in project android_frameworks_base by crdroidandroid.
the class BaseActivity method addListenerForLaunchCompletion.
/**
* Closes the activity when it's idle.
*/
private void addListenerForLaunchCompletion() {
addEventListener(new EventListener() {
@Override
public void onDirectoryNavigated(Uri uri) {
}
@Override
public void onDirectoryLoaded(Uri uri) {
removeEventListener(this);
getMainLooper().getQueue().addIdleHandler(new IdleHandler() {
@Override
public boolean queueIdle() {
// close the activity once idle, and notify the testing activity.
if (getIntent().getBooleanExtra(EXTRA_BENCHMARK, false) && BENCHMARK_TESTING_PACKAGE.equals(getCallingPackage())) {
setResult(RESULT_OK);
finish();
}
Metrics.logStartupMs(BaseActivity.this, (int) (new Date().getTime() - mStartTime));
// Remove the idle handler.
return false;
}
});
new Handler().post(new Runnable() {
@Override
public void run() {
}
});
}
});
}
Aggregations