Loading services/core/java/com/android/server/pm/EphemeralResolverConnection.java +16 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; import android.os.IBinder.DeathRecipient; import android.os.IRemoteCallback; import android.os.IRemoteCallback; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemClock; Loading @@ -47,7 +48,7 @@ import java.util.concurrent.TimeoutException; * service and handling all interactions in a timely manner. * service and handling all interactions in a timely manner. * @hide * @hide */ */ final class EphemeralResolverConnection { final class EphemeralResolverConnection implements DeathRecipient { // This is running in a critical section and the timeout must be sufficiently low // This is running in a critical section and the timeout must be sufficiently low private static final long BIND_SERVICE_TIMEOUT_MS = private static final long BIND_SERVICE_TIMEOUT_MS = ("eng".equals(Build.TYPE)) ? 300 : 200; ("eng".equals(Build.TYPE)) ? 300 : 200; Loading Loading @@ -171,6 +172,15 @@ final class EphemeralResolverConnection { } } } } @Override public void binderDied() { if (mRemoteInstance != null) { mRemoteInstance.asBinder().unlinkToDeath(this, 0 /*flags*/); } mRemoteInstance = null; mBindRequested = false; } /** /** * Asynchronous callback when results come back from ephemeral resolution phase two. * Asynchronous callback when results come back from ephemeral resolution phase two. */ */ Loading @@ -183,7 +193,11 @@ final class EphemeralResolverConnection { @Override @Override public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) { synchronized (mLock) { synchronized (mLock) { try { service.linkToDeath(EphemeralResolverConnection.this, 0 /*flags*/); mRemoteInstance = IInstantAppResolver.Stub.asInterface(service); mRemoteInstance = IInstantAppResolver.Stub.asInterface(service); } catch (RemoteException e) { } mLock.notifyAll(); mLock.notifyAll(); } } } } Loading Loading
services/core/java/com/android/server/pm/EphemeralResolverConnection.java +16 −2 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; import android.os.IBinder.DeathRecipient; import android.os.IRemoteCallback; import android.os.IRemoteCallback; import android.os.RemoteException; import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemClock; Loading @@ -47,7 +48,7 @@ import java.util.concurrent.TimeoutException; * service and handling all interactions in a timely manner. * service and handling all interactions in a timely manner. * @hide * @hide */ */ final class EphemeralResolverConnection { final class EphemeralResolverConnection implements DeathRecipient { // This is running in a critical section and the timeout must be sufficiently low // This is running in a critical section and the timeout must be sufficiently low private static final long BIND_SERVICE_TIMEOUT_MS = private static final long BIND_SERVICE_TIMEOUT_MS = ("eng".equals(Build.TYPE)) ? 300 : 200; ("eng".equals(Build.TYPE)) ? 300 : 200; Loading Loading @@ -171,6 +172,15 @@ final class EphemeralResolverConnection { } } } } @Override public void binderDied() { if (mRemoteInstance != null) { mRemoteInstance.asBinder().unlinkToDeath(this, 0 /*flags*/); } mRemoteInstance = null; mBindRequested = false; } /** /** * Asynchronous callback when results come back from ephemeral resolution phase two. * Asynchronous callback when results come back from ephemeral resolution phase two. */ */ Loading @@ -183,7 +193,11 @@ final class EphemeralResolverConnection { @Override @Override public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) { synchronized (mLock) { synchronized (mLock) { try { service.linkToDeath(EphemeralResolverConnection.this, 0 /*flags*/); mRemoteInstance = IInstantAppResolver.Stub.asInterface(service); mRemoteInstance = IInstantAppResolver.Stub.asInterface(service); } catch (RemoteException e) { } mLock.notifyAll(); mLock.notifyAll(); } } } } Loading