use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class LayoutTestsExecutor method onCreate.
/** IMPLEMENTATION */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* It detects the crash by catching all the uncaught exceptions. However, we
* still have to kill the process, because after catching the exception the
* activity remains in a strange state, where intents don't revive it.
* However, we send the message to the service to speed up the rebooting
* (we don't have to wait for time-out to kick in).
*/
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
Log.w(LOG_TAG, "onTestCrashed(): " + mCurrentTestRelativePath + " thread=" + thread, e);
try {
Message serviceMsg = Message.obtain(null, ManagerService.MSG_CURRENT_TEST_CRASHED);
mManagerServiceMessenger.send(serviceMsg);
} catch (RemoteException e2) {
Log.e(LOG_TAG, "mCurrentTestRelativePath=" + mCurrentTestRelativePath, e2);
}
Process.killProcess(Process.myPid());
}
});
requestWindowFeature(Window.FEATURE_PROGRESS);
Intent intent = getIntent();
mTestsList = FsUtils.loadTestListFromStorage(intent.getStringExtra(EXTRA_TESTS_FILE));
mCurrentTestIndex = intent.getIntExtra(EXTRA_TEST_INDEX, -1);
mTotalTestCount = mCurrentTestIndex + mTestsList.size();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mScreenDimLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "WakeLock in LayoutTester");
mScreenDimLock.acquire();
bindService(new Intent(this, ManagerService.class), mServiceConnection, Context.BIND_AUTO_CREATE);
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class LayoutTestsExecutor method sendFirstTestMessage.
private void sendFirstTestMessage() {
try {
Message serviceMsg = Message.obtain(null, ManagerService.MSG_FIRST_TEST);
Bundle bundle = new Bundle();
bundle.putString("firstTest", mTestsList.get(0));
bundle.putInt("index", mCurrentTestIndex);
serviceMsg.setData(bundle);
mManagerServiceMessenger.send(serviceMsg);
} catch (RemoteException e) {
Log.e(LOG_TAG, "Error sending message to manager service:", e);
}
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class LayoutTestsExecutor method setXSSAuditorEnabled.
public void setXSSAuditorEnabled(boolean flag) {
Log.i(LOG_TAG, mCurrentTestRelativePath + ": setXSSAuditorEnabled(" + flag + ") called");
Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_XSS_AUDITOR_ENABLED);
msg.arg1 = flag ? 1 : 0;
msg.sendToTarget();
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class CallbackProxy method overridePreference.
public void overridePreference(String key, boolean value) {
Message message = obtainMessage(OVERRIDE_PREFERENCE);
message.getData().putString("key", key);
message.getData().putBoolean("value", value);
message.sendToTarget();
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class TestShellActivity method executeIntent.
private void executeIntent(Intent intent) {
resetTestStatus();
if (!Intent.ACTION_VIEW.equals(intent.getAction())) {
return;
}
mTotalTestCount = intent.getIntExtra(TOTAL_TEST_COUNT, mTotalTestCount);
mCurrentTestNumber = intent.getIntExtra(CURRENT_TEST_NUMBER, mCurrentTestNumber);
mTestUrl = intent.getStringExtra(TEST_URL);
if (mTestUrl == null) {
mUiAutoTestPath = intent.getStringExtra(UI_AUTO_TEST);
if (mUiAutoTestPath != null) {
beginUiAutoTest();
}
return;
}
mResultFile = intent.getStringExtra(RESULT_FILE);
mTimeoutInMillis = intent.getIntExtra(TIMEOUT_IN_MILLIS, 0);
mStopOnRefError = intent.getBooleanExtra(STOP_ON_REF_ERROR, false);
setTitle("Test " + mCurrentTestNumber + " of " + mTotalTestCount);
float ratio = (float) mCurrentTestNumber / mTotalTestCount;
int progress = (int) (ratio * Window.PROGRESS_END);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress);
Log.v(LOGTAG, " Loading " + mTestUrl);
if (mTestUrl.contains("/dumpAsText/")) {
dumpAsText(false);
}
mWebView.loadUrl(mTestUrl);
if (mTimeoutInMillis > 0) {
// Create a timeout timer
Message m = mHandler.obtainMessage(MSG_TIMEOUT);
mHandler.sendMessageDelayed(m, mTimeoutInMillis);
}
}
Aggregations