Make UserTrackerImpl more extensible
Bug: 254133820 Test: build Change-Id: Ib290941fd1860011b0b03a33162e58b09c7d1560
This commit is contained in:
@@ -30,7 +30,6 @@ import androidx.annotation.GuardedBy
|
||||
import androidx.annotation.WorkerThread
|
||||
import com.android.systemui.Dumpable
|
||||
import com.android.systemui.dump.DumpManager
|
||||
import com.android.systemui.people.widget.PeopleSpaceWidgetProvider.EXTRA_USER_HANDLE
|
||||
import com.android.systemui.util.Assert
|
||||
import java.io.PrintWriter
|
||||
import java.lang.ref.WeakReference
|
||||
@@ -53,7 +52,7 @@ import kotlin.reflect.KProperty
|
||||
*
|
||||
* Class constructed and initialized in [SettingsModule].
|
||||
*/
|
||||
class UserTrackerImpl internal constructor(
|
||||
open class UserTrackerImpl internal constructor(
|
||||
private val context: Context,
|
||||
private val userManager: UserManager,
|
||||
private val dumpManager: DumpManager,
|
||||
@@ -70,13 +69,13 @@ class UserTrackerImpl internal constructor(
|
||||
private val mutex = Any()
|
||||
|
||||
override var userId: Int by SynchronizedDelegate(context.userId)
|
||||
private set
|
||||
protected set
|
||||
|
||||
override var userHandle: UserHandle by SynchronizedDelegate(context.user)
|
||||
private set
|
||||
protected set
|
||||
|
||||
override var userContext: Context by SynchronizedDelegate(context)
|
||||
private set
|
||||
protected set
|
||||
|
||||
override val userContentResolver: ContentResolver
|
||||
get() = userContext.contentResolver
|
||||
@@ -94,7 +93,7 @@ class UserTrackerImpl internal constructor(
|
||||
* modified.
|
||||
*/
|
||||
override var userProfiles: List<UserInfo> by SynchronizedDelegate(emptyList())
|
||||
private set
|
||||
protected set
|
||||
|
||||
@GuardedBy("callbacks")
|
||||
private val callbacks: MutableList<DataItem> = ArrayList()
|
||||
@@ -155,7 +154,7 @@ class UserTrackerImpl internal constructor(
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun handleSwitchUser(newUser: Int) {
|
||||
protected open fun handleSwitchUser(newUser: Int) {
|
||||
Assert.isNotMainThread()
|
||||
if (newUser == UserHandle.USER_NULL) {
|
||||
Log.w(TAG, "handleSwitchUser - Couldn't get new id from intent")
|
||||
@@ -174,7 +173,7 @@ class UserTrackerImpl internal constructor(
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun handleProfilesChanged() {
|
||||
protected open fun handleProfilesChanged() {
|
||||
Assert.isNotMainThread()
|
||||
|
||||
val profiles = userManager.getProfiles(userId)
|
||||
|
||||
Reference in New Issue
Block a user