Loading packages/SystemUI/src/com/android/systemui/sensorprivacy/SensorUseStartedActivity.kt +25 −6 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.hardware.SensorPrivacyManager.EXTRA_SENSOR import android.hardware.SensorPrivacyManager.INDIVIDUAL_SENSOR_CAMERA import android.hardware.SensorPrivacyManager.INDIVIDUAL_SENSOR_MICROPHONE import android.os.Bundle import android.os.Handler import android.text.Html import android.util.Log import com.android.internal.app.AlertActivity Loading @@ -43,10 +44,13 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene companion object { private val LOG_TAG = SensorUseStartedActivity::class.java.simpleName private const val SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS = 2000L } private var sensor = -1 private lateinit var sensorUsePackageName: String private var unsuppressImmediately = false private lateinit var sensorPrivacyManager: SensorPrivacyManager private lateinit var appOpsManager: AppOpsManager Loading Loading @@ -118,6 +122,7 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene super.onStart() sensorPrivacyManager.suppressIndividualSensorPrivacyReminders(sensorUsePackageName, true) unsuppressImmediately = false } override fun onClick(dialog: DialogInterface?, which: Int) { Loading @@ -131,15 +136,15 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene } override fun onDismissSucceeded() { sensorPrivacyManager .setIndividualSensorPrivacyForProfileGroup(sensor, false) setResult(RESULT_OK) disableSensorPrivacy() } }) } else { sensorPrivacyManager.setIndividualSensorPrivacyForProfileGroup(sensor, false) setResult(RESULT_OK) disableSensorPrivacy() } } BUTTON_NEGATIVE -> { unsuppressImmediately = false } } Loading @@ -149,10 +154,24 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene override fun onStop() { super.onDestroy() sensorPrivacyManager.suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) if (unsuppressImmediately) { sensorPrivacyManager .suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) } else { Handler(mainLooper).postDelayed({ sensorPrivacyManager .suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) }, SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS) } } override fun onBackPressed() { // do not allow backing out } private fun disableSensorPrivacy() { sensorPrivacyManager.setIndividualSensorPrivacyForProfileGroup(sensor, false) unsuppressImmediately = true setResult(RESULT_OK) } } No newline at end of file services/core/java/com/android/server/SensorPrivacyService.java +8 −6 Original line number Diff line number Diff line Loading @@ -105,8 +105,6 @@ public final class SensorPrivacyService extends SystemService { private static final String TAG = "SensorPrivacyService"; private static final int SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS = 2000; /** Version number indicating compatibility parsing the persisted file */ private static final int CURRENT_PERSISTENCE_VERSION = 1; /** Version number indicating the persisted data needs upgraded to match new internal data Loading Loading @@ -756,10 +754,7 @@ public final class SensorPrivacyService extends SystemService { suppressPackageReminderTokens.add(token); } else { mHandler.postDelayed(PooledLambda.obtainRunnable( SensorPrivacyServiceImpl::removeSuppressPackageReminderToken, this, key, token), SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS); mHandler.removeSuppressPackageReminderToken(key, token); } } } Loading Loading @@ -1110,6 +1105,13 @@ public final class SensorPrivacyService extends SystemService { } listeners.finishBroadcast(); } public void removeSuppressPackageReminderToken(Pair<String, UserHandle> key, IBinder token) { sendMessage(PooledLambda.obtainMessage( SensorPrivacyServiceImpl::removeSuppressPackageReminderToken, mSensorPrivacyServiceImpl, key, token)); } } private final class DeathRecipient implements IBinder.DeathRecipient { Loading Loading
packages/SystemUI/src/com/android/systemui/sensorprivacy/SensorUseStartedActivity.kt +25 −6 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.hardware.SensorPrivacyManager.EXTRA_SENSOR import android.hardware.SensorPrivacyManager.INDIVIDUAL_SENSOR_CAMERA import android.hardware.SensorPrivacyManager.INDIVIDUAL_SENSOR_MICROPHONE import android.os.Bundle import android.os.Handler import android.text.Html import android.util.Log import com.android.internal.app.AlertActivity Loading @@ -43,10 +44,13 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene companion object { private val LOG_TAG = SensorUseStartedActivity::class.java.simpleName private const val SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS = 2000L } private var sensor = -1 private lateinit var sensorUsePackageName: String private var unsuppressImmediately = false private lateinit var sensorPrivacyManager: SensorPrivacyManager private lateinit var appOpsManager: AppOpsManager Loading Loading @@ -118,6 +122,7 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene super.onStart() sensorPrivacyManager.suppressIndividualSensorPrivacyReminders(sensorUsePackageName, true) unsuppressImmediately = false } override fun onClick(dialog: DialogInterface?, which: Int) { Loading @@ -131,15 +136,15 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene } override fun onDismissSucceeded() { sensorPrivacyManager .setIndividualSensorPrivacyForProfileGroup(sensor, false) setResult(RESULT_OK) disableSensorPrivacy() } }) } else { sensorPrivacyManager.setIndividualSensorPrivacyForProfileGroup(sensor, false) setResult(RESULT_OK) disableSensorPrivacy() } } BUTTON_NEGATIVE -> { unsuppressImmediately = false } } Loading @@ -149,10 +154,24 @@ class SensorUseStartedActivity : AlertActivity(), DialogInterface.OnClickListene override fun onStop() { super.onDestroy() sensorPrivacyManager.suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) if (unsuppressImmediately) { sensorPrivacyManager .suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) } else { Handler(mainLooper).postDelayed({ sensorPrivacyManager .suppressIndividualSensorPrivacyReminders(sensorUsePackageName, false) }, SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS) } } override fun onBackPressed() { // do not allow backing out } private fun disableSensorPrivacy() { sensorPrivacyManager.setIndividualSensorPrivacyForProfileGroup(sensor, false) unsuppressImmediately = true setResult(RESULT_OK) } } No newline at end of file
services/core/java/com/android/server/SensorPrivacyService.java +8 −6 Original line number Diff line number Diff line Loading @@ -105,8 +105,6 @@ public final class SensorPrivacyService extends SystemService { private static final String TAG = "SensorPrivacyService"; private static final int SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS = 2000; /** Version number indicating compatibility parsing the persisted file */ private static final int CURRENT_PERSISTENCE_VERSION = 1; /** Version number indicating the persisted data needs upgraded to match new internal data Loading Loading @@ -756,10 +754,7 @@ public final class SensorPrivacyService extends SystemService { suppressPackageReminderTokens.add(token); } else { mHandler.postDelayed(PooledLambda.obtainRunnable( SensorPrivacyServiceImpl::removeSuppressPackageReminderToken, this, key, token), SUPPRESS_REMINDERS_REMOVAL_DELAY_MILLIS); mHandler.removeSuppressPackageReminderToken(key, token); } } } Loading Loading @@ -1110,6 +1105,13 @@ public final class SensorPrivacyService extends SystemService { } listeners.finishBroadcast(); } public void removeSuppressPackageReminderToken(Pair<String, UserHandle> key, IBinder token) { sendMessage(PooledLambda.obtainMessage( SensorPrivacyServiceImpl::removeSuppressPackageReminderToken, mSensorPrivacyServiceImpl, key, token)); } } private final class DeathRecipient implements IBinder.DeathRecipient { Loading