Loading core/java/android/hardware/location/ISignificantPlaceProvider.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,5 @@ import android.hardware.location.ISignificantPlaceProviderManager; */ oneway interface ISignificantPlaceProvider { void setSignificantPlaceProviderManager(in ISignificantPlaceProviderManager manager); void onSignificantPlaceCheck(); } location/lib/java/com/android/location/provider/SignificantPlaceProvider.java +27 −2 Original line number Diff line number Diff line Loading @@ -21,17 +21,22 @@ import android.app.trust.TrustManager; import android.hardware.location.ISignificantPlaceProvider; import android.hardware.location.ISignificantPlaceProviderManager; import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Process; import android.os.RemoteException; import android.util.Log; import com.android.internal.annotations.GuardedBy; /** @hide */ public class SignificantPlaceProvider { public abstract class SignificantPlaceProvider { public static final String ACTION = TrustManager.ACTION_BIND_SIGNIFICANT_PLACE_PROVIDER; private static final String TAG = "SignificantPlaceProvider"; private final IBinder mBinder; // write locked on mBinder, read lock is optional depending on atomicity requirements Loading Loading @@ -69,6 +74,9 @@ public class SignificantPlaceProvider { } } /** Invoked when some client has checked whether the device is in a significant place. */ public abstract void onSignificantPlaceCheck(); private final class Service extends ISignificantPlaceProvider.Stub { Service() {} Loading @@ -76,7 +84,7 @@ public class SignificantPlaceProvider { @Override public void setSignificantPlaceProviderManager(ISignificantPlaceProviderManager manager) { if (Binder.getCallingUid() != Process.SYSTEM_UID) { return; throw new SecurityException(); } synchronized (mBinder) { Loading @@ -91,5 +99,22 @@ public class SignificantPlaceProvider { mManager = manager; } } @Override public void onSignificantPlaceCheck() { if (Binder.getCallingUid() != Process.SYSTEM_UID) { throw new SecurityException(); } try { SignificantPlaceProvider.this.onSignificantPlaceCheck(); } catch (RuntimeException e) { // exceptions on one-way binder threads are dropped - move to a different thread Log.w(TAG, e); new Handler(Looper.getMainLooper()).post(() -> { throw new AssertionError(e); }); } } } } services/core/java/com/android/server/trust/TrustManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1870,6 +1870,11 @@ public class TrustManagerService extends SystemService { @Override public boolean isInSignificantPlace() { if (android.security.Flags.significantPlaces()) { mSignificantPlaceServiceWatcher.runOnBinder( binder -> ISignificantPlaceProvider.Stub.asInterface(binder) .onSignificantPlaceCheck()); } return mIsInSignificantPlace; } Loading Loading
core/java/android/hardware/location/ISignificantPlaceProvider.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,5 @@ import android.hardware.location.ISignificantPlaceProviderManager; */ oneway interface ISignificantPlaceProvider { void setSignificantPlaceProviderManager(in ISignificantPlaceProviderManager manager); void onSignificantPlaceCheck(); }
location/lib/java/com/android/location/provider/SignificantPlaceProvider.java +27 −2 Original line number Diff line number Diff line Loading @@ -21,17 +21,22 @@ import android.app.trust.TrustManager; import android.hardware.location.ISignificantPlaceProvider; import android.hardware.location.ISignificantPlaceProviderManager; import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Process; import android.os.RemoteException; import android.util.Log; import com.android.internal.annotations.GuardedBy; /** @hide */ public class SignificantPlaceProvider { public abstract class SignificantPlaceProvider { public static final String ACTION = TrustManager.ACTION_BIND_SIGNIFICANT_PLACE_PROVIDER; private static final String TAG = "SignificantPlaceProvider"; private final IBinder mBinder; // write locked on mBinder, read lock is optional depending on atomicity requirements Loading Loading @@ -69,6 +74,9 @@ public class SignificantPlaceProvider { } } /** Invoked when some client has checked whether the device is in a significant place. */ public abstract void onSignificantPlaceCheck(); private final class Service extends ISignificantPlaceProvider.Stub { Service() {} Loading @@ -76,7 +84,7 @@ public class SignificantPlaceProvider { @Override public void setSignificantPlaceProviderManager(ISignificantPlaceProviderManager manager) { if (Binder.getCallingUid() != Process.SYSTEM_UID) { return; throw new SecurityException(); } synchronized (mBinder) { Loading @@ -91,5 +99,22 @@ public class SignificantPlaceProvider { mManager = manager; } } @Override public void onSignificantPlaceCheck() { if (Binder.getCallingUid() != Process.SYSTEM_UID) { throw new SecurityException(); } try { SignificantPlaceProvider.this.onSignificantPlaceCheck(); } catch (RuntimeException e) { // exceptions on one-way binder threads are dropped - move to a different thread Log.w(TAG, e); new Handler(Looper.getMainLooper()).post(() -> { throw new AssertionError(e); }); } } } }
services/core/java/com/android/server/trust/TrustManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1870,6 +1870,11 @@ public class TrustManagerService extends SystemService { @Override public boolean isInSignificantPlace() { if (android.security.Flags.significantPlaces()) { mSignificantPlaceServiceWatcher.runOnBinder( binder -> ISignificantPlaceProvider.Stub.asInterface(binder) .onSignificantPlaceCheck()); } return mIsInSignificantPlace; } Loading