Loading services/core/java/com/android/server/SensorPrivacyService.java +10 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static android.app.AppOpsManager.OP_RECORD_AUDIO; import static android.content.Intent.EXTRA_PACKAGE_NAME; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.hardware.SensorPrivacyManager.EXTRA_ALL_SENSORS; import static android.hardware.SensorPrivacyManager.EXTRA_SENSOR; Loading Loading @@ -75,6 +76,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.graphics.drawable.Icon; import android.hardware.ISensorPrivacyListener; Loading Loading @@ -188,6 +190,7 @@ public final class SensorPrivacyService extends SystemService { private final AppOpsManager mAppOpsManager; private final AppOpsManagerInternal mAppOpsManagerInternal; private final TelephonyManager mTelephonyManager; private final PackageManagerInternal mPackageManagerInternal; private final IBinder mAppOpsRestrictionToken = new Binder(); Loading @@ -208,6 +211,7 @@ public final class SensorPrivacyService extends SystemService { mActivityManagerInternal = getLocalService(ActivityManagerInternal.class); mActivityTaskManager = context.getSystemService(ActivityTaskManager.class); mTelephonyManager = context.getSystemService(TelephonyManager.class); mPackageManagerInternal = getLocalService(PackageManagerInternal.class); mSensorPrivacyServiceImpl = new SensorPrivacyServiceImpl(); } Loading Loading @@ -877,6 +881,12 @@ public final class SensorPrivacyService extends SystemService { * sensor privacy. */ private void enforceObserveSensorPrivacyPermission() { String systemUIPackage = mContext.getString(R.string.config_systemUi); if (Binder.getCallingUid() == mPackageManagerInternal .getPackageUid(systemUIPackage, MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM)) { // b/221782106, possible race condition with role grant might bootloop device. return; } enforcePermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY, "Observing sensor privacy changes requires the following permission: " + android.Manifest.permission.OBSERVE_SENSOR_PRIVACY); Loading Loading
services/core/java/com/android/server/SensorPrivacyService.java +10 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static android.app.AppOpsManager.OP_RECORD_AUDIO; import static android.content.Intent.EXTRA_PACKAGE_NAME; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION; import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.hardware.SensorPrivacyManager.EXTRA_ALL_SENSORS; import static android.hardware.SensorPrivacyManager.EXTRA_SENSOR; Loading Loading @@ -75,6 +76,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.graphics.drawable.Icon; import android.hardware.ISensorPrivacyListener; Loading Loading @@ -188,6 +190,7 @@ public final class SensorPrivacyService extends SystemService { private final AppOpsManager mAppOpsManager; private final AppOpsManagerInternal mAppOpsManagerInternal; private final TelephonyManager mTelephonyManager; private final PackageManagerInternal mPackageManagerInternal; private final IBinder mAppOpsRestrictionToken = new Binder(); Loading @@ -208,6 +211,7 @@ public final class SensorPrivacyService extends SystemService { mActivityManagerInternal = getLocalService(ActivityManagerInternal.class); mActivityTaskManager = context.getSystemService(ActivityTaskManager.class); mTelephonyManager = context.getSystemService(TelephonyManager.class); mPackageManagerInternal = getLocalService(PackageManagerInternal.class); mSensorPrivacyServiceImpl = new SensorPrivacyServiceImpl(); } Loading Loading @@ -877,6 +881,12 @@ public final class SensorPrivacyService extends SystemService { * sensor privacy. */ private void enforceObserveSensorPrivacyPermission() { String systemUIPackage = mContext.getString(R.string.config_systemUi); if (Binder.getCallingUid() == mPackageManagerInternal .getPackageUid(systemUIPackage, MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM)) { // b/221782106, possible race condition with role grant might bootloop device. return; } enforcePermission(android.Manifest.permission.OBSERVE_SENSOR_PRIVACY, "Observing sensor privacy changes requires the following permission: " + android.Manifest.permission.OBSERVE_SENSOR_PRIVACY); Loading