Don't call into ActivityManagerInternal outside system process.

If ActivityManagerNative.isSystemReady is being called in a non-system
process, just return true instead of calling into
ActivityManagerInternal since system should be ready by now and
as ActivityManagerInternal is only available for system services.

Fixes: 32700143
Test: Test referenced in the bug is passing.
      adb shell am instrument -e class com.android.androidbvt.SysUIGSATests -w com.android.androidbvt/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ibb594f887f7f5391c34c686f2667a6696e4268a2
This commit is contained in:
Sudheer Shanka
2016-11-07 14:15:26 -08:00
parent e86ce54b49
commit ba45a68a5d

View File

@@ -16,7 +16,10 @@
package android.app;
import android.content.Intent;
import android.os.Debug;
import android.os.IBinder;
import android.util.Log;
import com.android.server.LocalServices;
/**
@@ -25,6 +28,8 @@ import com.android.server.LocalServices;
*/
@Deprecated
public abstract class ActivityManagerNative {
private final static String TAG = "ActivityManagerNative";
/**
* Cast a Binder object into an activity manager interface, generating
* a proxy if needed.
@@ -51,7 +56,14 @@ public abstract class ActivityManagerNative {
*/
static public boolean isSystemReady() {
if (!sSystemReady) {
sSystemReady = LocalServices.getService(ActivityManagerInternal.class).isSystemReady();
if (ActivityThread.isSystem()) {
sSystemReady =
LocalServices.getService(ActivityManagerInternal.class).isSystemReady();
} else {
// Since this is being called from outside system server, system should be
// ready by now.
sSystemReady = true;
}
}
return sSystemReady;
}