[Catalyst] Update PreferenceLifecycleContext.notifyPreferenceChange

Change the signature from metadata to preference key, so that the API
could be used to notify other preferences on the same screen.

NO_IFTTT=Catalyst only

Bug: 332201912
Flag: com.android.settings.flags.catalyst
Test: atest
Change-Id: Ibdf5f9004471d5491a0be1e84365cbe9f136c373
This commit is contained in:
Jacky Wang
2024-11-19 13:31:57 +08:00
parent 75c4dcb39b
commit 83708d4499
7 changed files with 29 additions and 24 deletions

View File

@@ -101,7 +101,7 @@ class AdaptiveSleepPreference :
val receiver =
object : BroadcastReceiver() {
override fun onReceive(receiverContext: Context, intent: Intent) {
context.notifyPreferenceChange(this@AdaptiveSleepPreference)
context.notifyPreferenceChange(KEY)
}
}
context.registerReceiver(
@@ -111,7 +111,7 @@ class AdaptiveSleepPreference :
broadcastReceiver = receiver
val listener = OnSensorPrivacyChangedListener { _, _ ->
context.notifyPreferenceChange(this)
context.notifyPreferenceChange(KEY)
}
SensorPrivacyManager.getInstance(context).addSensorPrivacyListener(CAMERA, listener)
sensorPrivacyChangedListener = listener