Loading services/core/java/com/android/server/DynamicAndroidService.java +21 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.IBinder.DeathRecipient; import android.os.IDynamicAndroidService; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.util.Slog; /** Loading @@ -34,6 +35,7 @@ import android.util.Slog; public class DynamicAndroidService extends IDynamicAndroidService.Stub implements DeathRecipient { private static final String TAG = "DynamicAndroidService"; private static final String NO_SERVICE_ERROR = "no gsiservice"; private static final int GSID_ROUGH_TIMEOUT_MS = 8192; private Context mContext; private volatile IGsiService mGsiService; Loading Loading @@ -66,6 +68,17 @@ public class DynamicAndroidService extends IDynamicAndroidService.Stub implement private IGsiService getGsiService() throws RemoteException { checkPermission(); if (!"running".equals(SystemProperties.get("init.svc.gsid"))) { SystemProperties.set("ctl.start", "gsid"); } for (int sleepMs = 64; sleepMs <= (GSID_ROUGH_TIMEOUT_MS << 1); sleepMs <<= 1) { try { Thread.sleep(sleepMs); } catch (InterruptedException e) { Slog.e(TAG, "Interrupted when waiting for GSID"); break; } if ("running".equals(SystemProperties.get("init.svc.gsid"))) { synchronized (this) { if (mGsiService == null) { mGsiService = connect(this); Loading @@ -73,6 +86,10 @@ public class DynamicAndroidService extends IDynamicAndroidService.Stub implement return mGsiService; } } } Slog.e(TAG, "Unable to start gsid"); return null; } private void checkPermission() { if (mContext.checkCallingOrSelfPermission( Loading Loading
services/core/java/com/android/server/DynamicAndroidService.java +21 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.IBinder.DeathRecipient; import android.os.IDynamicAndroidService; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.util.Slog; /** Loading @@ -34,6 +35,7 @@ import android.util.Slog; public class DynamicAndroidService extends IDynamicAndroidService.Stub implements DeathRecipient { private static final String TAG = "DynamicAndroidService"; private static final String NO_SERVICE_ERROR = "no gsiservice"; private static final int GSID_ROUGH_TIMEOUT_MS = 8192; private Context mContext; private volatile IGsiService mGsiService; Loading Loading @@ -66,6 +68,17 @@ public class DynamicAndroidService extends IDynamicAndroidService.Stub implement private IGsiService getGsiService() throws RemoteException { checkPermission(); if (!"running".equals(SystemProperties.get("init.svc.gsid"))) { SystemProperties.set("ctl.start", "gsid"); } for (int sleepMs = 64; sleepMs <= (GSID_ROUGH_TIMEOUT_MS << 1); sleepMs <<= 1) { try { Thread.sleep(sleepMs); } catch (InterruptedException e) { Slog.e(TAG, "Interrupted when waiting for GSID"); break; } if ("running".equals(SystemProperties.get("init.svc.gsid"))) { synchronized (this) { if (mGsiService == null) { mGsiService = connect(this); Loading @@ -73,6 +86,10 @@ public class DynamicAndroidService extends IDynamicAndroidService.Stub implement return mGsiService; } } } Slog.e(TAG, "Unable to start gsid"); return null; } private void checkPermission() { if (mContext.checkCallingOrSelfPermission( Loading