Merge "Fix starting user in Controls controllers" into rvc-dev am: 49cd3e5faf am: 90d4da0ab6

Change-Id: I4329a3d75fc446aa8da96794e1eb97b60b39217a
This commit is contained in:
Automerger Merge Worker
2020-02-26 18:08:33 +00:00
3 changed files with 14 additions and 11 deletions

View File

@@ -16,6 +16,7 @@
package com.android.systemui.controls.controller package com.android.systemui.controls.controller
import android.app.ActivityManager
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.os.IBinder import android.os.IBinder
@@ -50,7 +51,7 @@ open class ControlsBindingControllerImpl @Inject constructor(
private val refreshing = AtomicBoolean(false) private val refreshing = AtomicBoolean(false)
private var currentUser = context.user private var currentUser = UserHandle.of(ActivityManager.getCurrentUser())
override val currentUserId: Int override val currentUserId: Int
get() = currentUser.identifier get() = currentUser.identifier

View File

@@ -16,6 +16,7 @@
package com.android.systemui.controls.controller package com.android.systemui.controls.controller
import android.app.ActivityManager
import android.app.PendingIntent import android.app.PendingIntent
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.ComponentName import android.content.ComponentName
@@ -78,16 +79,16 @@ class ControlsControllerImpl @Inject constructor (
private var userChanging: Boolean = true private var userChanging: Boolean = true
private val contentResolver: ContentResolver private var currentUser = UserHandle.of(ActivityManager.getCurrentUser())
get() = context.contentResolver
override var available = Settings.Secure.getInt(
contentResolver, CONTROLS_AVAILABLE, DEFAULT_ENABLED) != 0
private set
private var currentUser = context.user
override val currentUserId override val currentUserId
get() = currentUser.identifier get() = currentUser.identifier
private val contentResolver: ContentResolver
get() = context.contentResolver
override var available = Settings.Secure.getIntForUser(
contentResolver, CONTROLS_AVAILABLE, DEFAULT_ENABLED, currentUserId) != 0
private set
private val persistenceWrapper = optionalWrapper.orElseGet { private val persistenceWrapper = optionalWrapper.orElseGet {
ControlsFavoritePersistenceWrapper( ControlsFavoritePersistenceWrapper(
Environment.buildPath( Environment.buildPath(
@@ -106,7 +107,7 @@ class ControlsControllerImpl @Inject constructor (
userContext.filesDir, ControlsFavoritePersistenceWrapper.FILE_NAME) userContext.filesDir, ControlsFavoritePersistenceWrapper.FILE_NAME)
persistenceWrapper.changeFile(fileName) persistenceWrapper.changeFile(fileName)
available = Settings.Secure.getIntForUser(contentResolver, CONTROLS_AVAILABLE, available = Settings.Secure.getIntForUser(contentResolver, CONTROLS_AVAILABLE,
/* default */ DEFAULT_ENABLED, newUser.identifier) != 0 DEFAULT_ENABLED, newUser.identifier) != 0
synchronized(currentFavorites) { synchronized(currentFavorites) {
currentFavorites.clear() currentFavorites.clear()
} }
@@ -142,7 +143,7 @@ class ControlsControllerImpl @Inject constructor (
return return
} }
available = Settings.Secure.getIntForUser(contentResolver, CONTROLS_AVAILABLE, available = Settings.Secure.getIntForUser(contentResolver, CONTROLS_AVAILABLE,
/* default */ DEFAULT_ENABLED, currentUserId) != 0 DEFAULT_ENABLED, currentUserId) != 0
synchronized(currentFavorites) { synchronized(currentFavorites) {
currentFavorites.clear() currentFavorites.clear()
} }

View File

@@ -16,6 +16,7 @@
package com.android.systemui.controls.management package com.android.systemui.controls.management
import android.app.ActivityManager
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.pm.ServiceInfo import android.content.pm.ServiceInfo
@@ -72,7 +73,7 @@ class ControlsListingControllerImpl @VisibleForTesting constructor(
private var availableServices = emptyList<ServiceInfo>() private var availableServices = emptyList<ServiceInfo>()
override var currentUserId = context.userId override var currentUserId = ActivityManager.getCurrentUser()
private set private set
private val serviceListingCallback = ServiceListing.Callback { private val serviceListingCallback = ServiceListing.Callback {