Merge "Fixes @Nullable issues in System UI and WMShell." into udc-qpr-dev
This commit is contained in:
@@ -41,9 +41,9 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
|
||||
private val ANIMATE_DURATION: Long = 200
|
||||
|
||||
private val positioner: BubblePositioner = positioner
|
||||
private val manageView by lazy { findViewById<ViewGroup>(R.id.manage_education_view) }
|
||||
private val manageButton by lazy { findViewById<Button>(R.id.manage_button) }
|
||||
private val gotItButton by lazy { findViewById<Button>(R.id.got_it) }
|
||||
private val manageView by lazy { requireViewById<ViewGroup>(R.id.manage_education_view) }
|
||||
private val manageButton by lazy { requireViewById<Button>(R.id.manage_button) }
|
||||
private val gotItButton by lazy { requireViewById<Button>(R.id.got_it) }
|
||||
|
||||
private var isHiding = false
|
||||
private var realManageButtonRect = Rect()
|
||||
@@ -122,7 +122,7 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
|
||||
manageButton
|
||||
.setOnClickListener {
|
||||
hide()
|
||||
expandedView.findViewById<View>(R.id.manage_button).performClick()
|
||||
expandedView.requireViewById<View>(R.id.manage_button).performClick()
|
||||
}
|
||||
gotItButton.setOnClickListener { hide() }
|
||||
setOnClickListener { hide() }
|
||||
|
||||
@@ -48,9 +48,9 @@ class StackEducationView constructor(
|
||||
private val positioner: BubblePositioner = positioner
|
||||
private val controller: BubbleController = controller
|
||||
|
||||
private val view by lazy { findViewById<View>(R.id.stack_education_layout) }
|
||||
private val titleTextView by lazy { findViewById<TextView>(R.id.stack_education_title) }
|
||||
private val descTextView by lazy { findViewById<TextView>(R.id.stack_education_description) }
|
||||
private val view by lazy { requireViewById<View>(R.id.stack_education_layout) }
|
||||
private val titleTextView by lazy { requireViewById<TextView>(R.id.stack_education_title) }
|
||||
private val descTextView by lazy { requireViewById<TextView>(R.id.stack_education_description) }
|
||||
|
||||
var isHiding = false
|
||||
private set
|
||||
|
||||
@@ -313,7 +313,7 @@ class DesktopTasksController(
|
||||
task.taskId
|
||||
)
|
||||
val wct = WindowContainerTransaction()
|
||||
wct.setBounds(task.token, null)
|
||||
wct.setBounds(task.token, Rect())
|
||||
|
||||
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||
enterDesktopTaskTransitionHandler.startCancelMoveToDesktopMode(wct,
|
||||
@@ -550,6 +550,7 @@ class DesktopTasksController(
|
||||
)
|
||||
// Check if we should skip handling this transition
|
||||
var reason = ""
|
||||
val triggerTask = request.triggerTask
|
||||
val shouldHandleRequest =
|
||||
when {
|
||||
// Only handle open or to front transitions
|
||||
@@ -558,19 +559,19 @@ class DesktopTasksController(
|
||||
false
|
||||
}
|
||||
// Only handle when it is a task transition
|
||||
request.triggerTask == null -> {
|
||||
triggerTask == null -> {
|
||||
reason = "triggerTask is null"
|
||||
false
|
||||
}
|
||||
// Only handle standard type tasks
|
||||
request.triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> {
|
||||
reason = "activityType not handled (${request.triggerTask.activityType})"
|
||||
triggerTask.activityType != ACTIVITY_TYPE_STANDARD -> {
|
||||
reason = "activityType not handled (${triggerTask.activityType})"
|
||||
false
|
||||
}
|
||||
// Only handle fullscreen or freeform tasks
|
||||
request.triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
|
||||
request.triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> {
|
||||
reason = "windowingMode not handled (${request.triggerTask.windowingMode})"
|
||||
triggerTask.windowingMode != WINDOWING_MODE_FULLSCREEN &&
|
||||
triggerTask.windowingMode != WINDOWING_MODE_FREEFORM -> {
|
||||
reason = "windowingMode not handled (${triggerTask.windowingMode})"
|
||||
false
|
||||
}
|
||||
// Otherwise process it
|
||||
@@ -586,17 +587,17 @@ class DesktopTasksController(
|
||||
return null
|
||||
}
|
||||
|
||||
val task: RunningTaskInfo = request.triggerTask
|
||||
|
||||
val result = when {
|
||||
// If display has tasks stashed, handle as stashed launch
|
||||
desktopModeTaskRepository.isStashed(task.displayId) -> handleStashedTaskLaunch(task)
|
||||
// Check if fullscreen task should be updated
|
||||
task.windowingMode == WINDOWING_MODE_FULLSCREEN -> handleFullscreenTaskLaunch(task)
|
||||
// Check if freeform task should be updated
|
||||
task.windowingMode == WINDOWING_MODE_FREEFORM -> handleFreeformTaskLaunch(task)
|
||||
else -> {
|
||||
null
|
||||
val result = triggerTask?.let { task ->
|
||||
when {
|
||||
// If display has tasks stashed, handle as stashed launch
|
||||
desktopModeTaskRepository.isStashed(task.displayId) -> handleStashedTaskLaunch(task)
|
||||
// Check if fullscreen task should be updated
|
||||
task.windowingMode == WINDOWING_MODE_FULLSCREEN -> handleFullscreenTaskLaunch(task)
|
||||
// Check if freeform task should be updated
|
||||
task.windowingMode == WINDOWING_MODE_FREEFORM -> handleFreeformTaskLaunch(task)
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
KtProtoLog.v(
|
||||
@@ -703,7 +704,7 @@ class DesktopTasksController(
|
||||
WINDOWING_MODE_FULLSCREEN
|
||||
}
|
||||
wct.setWindowingMode(taskInfo.token, targetWindowingMode)
|
||||
wct.setBounds(taskInfo.token, null)
|
||||
wct.setBounds(taskInfo.token, Rect())
|
||||
if (isDesktopDensityOverrideSet()) {
|
||||
wct.setDensityDpi(taskInfo.token, getDefaultDensityDpi())
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class ToggleResizeDesktopTaskTransitionHandler(
|
||||
): Boolean {
|
||||
val change = findRelevantChange(info)
|
||||
val leash = change.leash
|
||||
val taskId = change.taskInfo.taskId
|
||||
val taskId = checkNotNull(change.taskInfo).taskId
|
||||
val startBounds = change.startAbsBounds
|
||||
val endBounds = change.endAbsBounds
|
||||
val windowDecor =
|
||||
|
||||
@@ -23,14 +23,14 @@ internal class DesktopModeAppControlsWindowDecorationViewHolder(
|
||||
appIcon: Drawable
|
||||
) : DesktopModeWindowDecorationViewHolder(rootView) {
|
||||
|
||||
private val captionView: View = rootView.findViewById(R.id.desktop_mode_caption)
|
||||
private val captionHandle: View = rootView.findViewById(R.id.caption_handle)
|
||||
private val openMenuButton: View = rootView.findViewById(R.id.open_menu_button)
|
||||
private val closeWindowButton: ImageButton = rootView.findViewById(R.id.close_window)
|
||||
private val expandMenuButton: ImageButton = rootView.findViewById(R.id.expand_menu_button)
|
||||
private val maximizeWindowButton: ImageButton = rootView.findViewById(R.id.maximize_window)
|
||||
private val appNameTextView: TextView = rootView.findViewById(R.id.application_name)
|
||||
private val appIconImageView: ImageView = rootView.findViewById(R.id.application_icon)
|
||||
private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption)
|
||||
private val captionHandle: View = rootView.requireViewById(R.id.caption_handle)
|
||||
private val openMenuButton: View = rootView.requireViewById(R.id.open_menu_button)
|
||||
private val closeWindowButton: ImageButton = rootView.requireViewById(R.id.close_window)
|
||||
private val expandMenuButton: ImageButton = rootView.requireViewById(R.id.expand_menu_button)
|
||||
private val maximizeWindowButton: ImageButton = rootView.requireViewById(R.id.maximize_window)
|
||||
private val appNameTextView: TextView = rootView.requireViewById(R.id.application_name)
|
||||
private val appIconImageView: ImageView = rootView.requireViewById(R.id.application_icon)
|
||||
|
||||
init {
|
||||
captionView.setOnTouchListener(onCaptionTouchListener)
|
||||
@@ -47,7 +47,9 @@ internal class DesktopModeAppControlsWindowDecorationViewHolder(
|
||||
override fun bindData(taskInfo: RunningTaskInfo) {
|
||||
|
||||
val captionDrawable = captionView.background as GradientDrawable
|
||||
captionDrawable.setColor(taskInfo.taskDescription.statusBarColor)
|
||||
taskInfo.taskDescription?.statusBarColor?.let {
|
||||
captionDrawable.setColor(it)
|
||||
}
|
||||
|
||||
closeWindowButton.imageTintList = ColorStateList.valueOf(
|
||||
getCaptionCloseButtonColor(taskInfo))
|
||||
|
||||
@@ -17,8 +17,8 @@ internal class DesktopModeFocusedWindowDecorationViewHolder(
|
||||
onCaptionButtonClickListener: View.OnClickListener
|
||||
) : DesktopModeWindowDecorationViewHolder(rootView) {
|
||||
|
||||
private val captionView: View = rootView.findViewById(R.id.desktop_mode_caption)
|
||||
private val captionHandle: ImageButton = rootView.findViewById(R.id.caption_handle)
|
||||
private val captionView: View = rootView.requireViewById(R.id.desktop_mode_caption)
|
||||
private val captionHandle: ImageButton = rootView.requireViewById(R.id.caption_handle)
|
||||
|
||||
init {
|
||||
captionView.setOnTouchListener(onCaptionTouchListener)
|
||||
@@ -27,9 +27,10 @@ internal class DesktopModeFocusedWindowDecorationViewHolder(
|
||||
}
|
||||
|
||||
override fun bindData(taskInfo: RunningTaskInfo) {
|
||||
val captionColor = taskInfo.taskDescription.statusBarColor
|
||||
val captionDrawable = captionView.background as GradientDrawable
|
||||
captionDrawable.setColor(captionColor)
|
||||
taskInfo.taskDescription?.statusBarColor?.let { captionColor ->
|
||||
val captionDrawable = captionView.background as GradientDrawable
|
||||
captionDrawable.setColor(captionColor)
|
||||
}
|
||||
|
||||
captionHandle.imageTintList = ColorStateList.valueOf(getCaptionHandleBarColor(taskInfo))
|
||||
}
|
||||
|
||||
@@ -25,11 +25,14 @@ internal abstract class DesktopModeWindowDecorationViewHolder(rootView: View) {
|
||||
* with the caption background color.
|
||||
*/
|
||||
protected fun shouldUseLightCaptionColors(taskInfo: RunningTaskInfo): Boolean {
|
||||
return if (Color.alpha(taskInfo.taskDescription.statusBarColor) != 0 &&
|
||||
taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) {
|
||||
Color.valueOf(taskInfo.taskDescription.statusBarColor).luminance() < 0.5
|
||||
} else {
|
||||
taskInfo.taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0
|
||||
}
|
||||
return taskInfo.taskDescription
|
||||
?.let { taskDescription ->
|
||||
if (Color.alpha(taskDescription.statusBarColor) != 0 &&
|
||||
taskInfo.windowingMode == WINDOWING_MODE_FREEFORM) {
|
||||
Color.valueOf(taskDescription.statusBarColor).luminance() < 0.5
|
||||
} else {
|
||||
taskDescription.statusBarAppearance and APPEARANCE_LIGHT_STATUS_BARS == 0
|
||||
}
|
||||
} ?: false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
|
||||
return batteryLevel
|
||||
}
|
||||
|
||||
override fun onBoundsChange(bounds: Rect?) {
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
super.onBoundsChange(bounds)
|
||||
updateSize()
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ constructor(
|
||||
// intent is to launch a dialog from another dialog.
|
||||
val animatedParent =
|
||||
openedDialogs.firstOrNull {
|
||||
it.dialog.window.decorView.viewRootImpl == controller.viewRoot
|
||||
it.dialog.window?.decorView?.viewRootImpl == controller.viewRoot
|
||||
}
|
||||
val controller =
|
||||
animatedParent?.dialogContentWithBackground?.let {
|
||||
@@ -336,7 +336,7 @@ constructor(
|
||||
): ActivityLaunchAnimator.Controller? {
|
||||
val animatedDialog =
|
||||
openedDialogs.firstOrNull {
|
||||
it.dialog.window.decorView.viewRootImpl == view.viewRootImpl
|
||||
it.dialog.window?.decorView?.viewRootImpl == view.viewRootImpl
|
||||
}
|
||||
?: return null
|
||||
return createActivityLaunchController(animatedDialog, cujType)
|
||||
@@ -417,7 +417,7 @@ constructor(
|
||||
animatedDialog.prepareForStackDismiss()
|
||||
|
||||
// Remove the dim.
|
||||
dialog.window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
dialog.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
}
|
||||
|
||||
override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
|
||||
@@ -783,7 +783,7 @@ private class AnimatedDialog(
|
||||
}
|
||||
|
||||
// Show the background dim.
|
||||
dialog.window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
dialog.window?.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
|
||||
startAnimation(
|
||||
isLaunching = true,
|
||||
@@ -863,7 +863,7 @@ private class AnimatedDialog(
|
||||
isLaunching = false,
|
||||
onLaunchAnimationStart = {
|
||||
// Remove the dim background as soon as we start the animation.
|
||||
dialog.window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
dialog.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
},
|
||||
onLaunchAnimationEnd = {
|
||||
val dialogContentWithBackground = this.dialogContentWithBackground!!
|
||||
|
||||
@@ -206,8 +206,9 @@ constructor(
|
||||
return
|
||||
}
|
||||
|
||||
backgroundView = FrameLayout(launchContainer.context)
|
||||
launchContainerOverlay.add(backgroundView)
|
||||
backgroundView = FrameLayout(launchContainer.context).also {
|
||||
launchContainerOverlay.add(it)
|
||||
}
|
||||
|
||||
// We wrap the ghosted view background and use it to draw the expandable background. Its
|
||||
// alpha will be set to 0 as soon as we start drawing the expanding background.
|
||||
@@ -319,7 +320,7 @@ constructor(
|
||||
backgroundDrawable?.wrapped?.alpha = startBackgroundAlpha
|
||||
|
||||
GhostView.removeGhost(ghostedView)
|
||||
launchContainerOverlay.remove(backgroundView)
|
||||
backgroundView?.let { launchContainerOverlay.remove(it) }
|
||||
|
||||
if (ghostedView is LaunchableView) {
|
||||
// Restore the ghosted view visibility.
|
||||
|
||||
@@ -283,7 +283,7 @@ class LaunchAnimator(private val timings: Timings, private val interpolators: In
|
||||
|
||||
animator.addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?, isReverse: Boolean) {
|
||||
override fun onAnimationStart(animation: Animator, isReverse: Boolean) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Animation started")
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class LaunchAnimator(private val timings: Timings, private val interpolators: In
|
||||
launchContainerOverlay.add(windowBackgroundLayer)
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Animation ended")
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ interface TypefaceVariantCache {
|
||||
return baseTypeface
|
||||
}
|
||||
|
||||
val axes = FontVariationAxis.fromFontVariationSettings(fVar).toMutableList()
|
||||
val axes = FontVariationAxis.fromFontVariationSettings(fVar)
|
||||
?.toMutableList()
|
||||
?: mutableListOf()
|
||||
axes.removeIf { !baseTypeface.isSupportedAxes(it.getOpenTypeTagValue()) }
|
||||
if (axes.isEmpty()) {
|
||||
return baseTypeface
|
||||
@@ -120,8 +122,8 @@ class TextAnimator(
|
||||
}
|
||||
addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) = textInterpolator.rebase()
|
||||
override fun onAnimationCancel(animation: Animator?) = textInterpolator.rebase()
|
||||
override fun onAnimationEnd(animation: Animator) = textInterpolator.rebase()
|
||||
override fun onAnimationCancel(animation: Animator) = textInterpolator.rebase()
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -302,11 +304,11 @@ class TextAnimator(
|
||||
if (onAnimationEnd != null) {
|
||||
val listener =
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
onAnimationEnd.run()
|
||||
animator.removeListener(this)
|
||||
}
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
animator.removeListener(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,7 +1046,7 @@ class ViewHierarchyAnimator {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
cancelled = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ constructor(
|
||||
|
||||
private fun readIntFromBundle(extras: Bundle, key: String): Int? =
|
||||
try {
|
||||
extras.getString(key).toInt()
|
||||
extras.getString(key)?.toInt()
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ object ActivityManagerKt {
|
||||
*/
|
||||
fun ActivityManager.isInForeground(packageName: String): Boolean {
|
||||
val tasks: List<ActivityManager.RunningTaskInfo> = getRunningTasks(1)
|
||||
return tasks.isNotEmpty() && packageName == tasks[0].topActivity.packageName
|
||||
return tasks.isNotEmpty() && packageName == tasks[0].topActivity?.packageName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,15 +31,15 @@ class SmartspaceState() : Parcelable {
|
||||
var visibleOnScreen = false
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
this.boundsOnScreen = parcel.readParcelable(Rect::javaClass.javaClass.classLoader)
|
||||
this.boundsOnScreen = parcel.readParcelable(Rect::javaClass.javaClass.classLoader) ?: Rect()
|
||||
this.selectedPage = parcel.readInt()
|
||||
this.visibleOnScreen = parcel.readBoolean()
|
||||
}
|
||||
|
||||
override fun writeToParcel(dest: Parcel?, flags: Int) {
|
||||
dest?.writeParcelable(boundsOnScreen, 0)
|
||||
dest?.writeInt(selectedPage)
|
||||
dest?.writeBoolean(visibleOnScreen)
|
||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||
dest.writeParcelable(boundsOnScreen, 0)
|
||||
dest.writeInt(selectedPage)
|
||||
dest.writeBoolean(visibleOnScreen)
|
||||
}
|
||||
|
||||
override fun describeContents(): Int {
|
||||
|
||||
@@ -39,7 +39,7 @@ class NaturalRotationUnfoldProgressProvider(
|
||||
|
||||
fun init() {
|
||||
rotationChangeProvider.addCallback(rotationListener)
|
||||
rotationListener.onRotationChanged(context.display.rotation)
|
||||
context.display?.rotation?.let { rotationListener.onRotationChanged(it) }
|
||||
}
|
||||
|
||||
private val rotationListener = RotationListener { rotation ->
|
||||
|
||||
@@ -105,7 +105,7 @@ open class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) :
|
||||
|
||||
hideAnimator.addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
super@BouncerKeyguardMessageArea.setMessage(msg, animate)
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ open class BouncerKeyguardMessageArea(context: Context?, attrs: AttributeSet?) :
|
||||
|
||||
showAnimator.addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
textAboutToShow = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ constructor(
|
||||
smallClockOnAttachStateChangeListener =
|
||||
object : OnAttachStateChangeListener {
|
||||
var pastVisibility: Int? = null
|
||||
override fun onViewAttachedToWindow(view: View?) {
|
||||
override fun onViewAttachedToWindow(view: View) {
|
||||
value.events.onTimeFormatChanged(DateFormat.is24HourFormat(context))
|
||||
if (view != null) {
|
||||
smallClockFrame = view.parent as FrameLayout
|
||||
@@ -168,7 +168,7 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(p0: View?) {
|
||||
override fun onViewDetachedFromWindow(p0: View) {
|
||||
smallClockFrame?.viewTreeObserver
|
||||
?.removeOnGlobalLayoutListener(onGlobalLayoutListener)
|
||||
}
|
||||
@@ -178,10 +178,10 @@ constructor(
|
||||
|
||||
largeClockOnAttachStateChangeListener =
|
||||
object : OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(p0: View?) {
|
||||
override fun onViewAttachedToWindow(p0: View) {
|
||||
value.events.onTimeFormatChanged(DateFormat.is24HourFormat(context))
|
||||
}
|
||||
override fun onViewDetachedFromWindow(p0: View?) {
|
||||
override fun onViewDetachedFromWindow(p0: View) {
|
||||
}
|
||||
}
|
||||
value.largeClock.view
|
||||
|
||||
@@ -230,7 +230,7 @@ class AuthRippleController @Inject constructor(
|
||||
lightRevealScrim.revealAmount = animator.animatedValue as Float
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
// Reset light reveal scrim to the default, so the CentralSurfaces
|
||||
// can handle any subsequent light reveal changes
|
||||
// (ie: from dozing changes)
|
||||
|
||||
@@ -147,12 +147,12 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
||||
retractDwellAnimator = AnimatorSet().apply {
|
||||
playTogether(retractDwellRippleAnimator, retractAlphaAnimator)
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
dwellPulseOutAnimator?.cancel()
|
||||
drawDwell = true
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
drawDwell = false
|
||||
resetDwellAlpha()
|
||||
}
|
||||
@@ -182,13 +182,13 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
||||
invalidate()
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
retractDwellAnimator?.cancel()
|
||||
dwellPulseOutAnimator?.cancel()
|
||||
drawDwell = true
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
drawDwell = false
|
||||
resetDwellAlpha()
|
||||
}
|
||||
@@ -239,14 +239,14 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
||||
expandDwellRippleAnimator
|
||||
)
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
retractDwellAnimator?.cancel()
|
||||
fadeDwellAnimator?.cancel()
|
||||
visibility = VISIBLE
|
||||
drawDwell = true
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
drawDwell = false
|
||||
}
|
||||
})
|
||||
@@ -273,12 +273,12 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
||||
|
||||
unlockedRippleAnimator = rippleAnimator.apply {
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
drawRipple = true
|
||||
visibility = VISIBLE
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
onAnimationEnd?.run()
|
||||
drawRipple = false
|
||||
visibility = GONE
|
||||
@@ -327,7 +327,7 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas?) {
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
// To reduce overdraw, we mask the effect to a circle whose radius is big enough to cover
|
||||
// the active effect area. Values here should be kept in sync with the
|
||||
// animation implementation in the ripple shader. (Twice bigger)
|
||||
|
||||
@@ -40,7 +40,7 @@ constructor(
|
||||
private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
|
||||
private val faceAuthInteractor: KeyguardFaceAuthInteractor,
|
||||
) : View.AccessibilityDelegate() {
|
||||
override fun onInitializeAccessibilityNodeInfo(host: View?, info: AccessibilityNodeInfo) {
|
||||
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info)
|
||||
if (keyguardUpdateMonitor.shouldListenForFace()) {
|
||||
val clickActionToRetryFace =
|
||||
@@ -52,7 +52,7 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun performAccessibilityAction(host: View?, action: Int, args: Bundle?): Boolean {
|
||||
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
|
||||
return if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.id) {
|
||||
keyguardUpdateMonitor.requestFaceAuth(FaceAuthApiRequestReason.ACCESSIBILITY_ACTION)
|
||||
faceAuthInteractor.onAccessibilityAction()
|
||||
|
||||
@@ -119,7 +119,7 @@ constructor(
|
||||
private var overlayView: View? = null
|
||||
set(value) {
|
||||
field?.let { oldView ->
|
||||
val lottie = oldView.findViewById(R.id.sidefps_animation) as LottieAnimationView
|
||||
val lottie = oldView.requireViewById(R.id.sidefps_animation) as LottieAnimationView
|
||||
lottie.pauseAnimation()
|
||||
windowManager.removeView(oldView)
|
||||
orientationListener.disable()
|
||||
@@ -274,7 +274,7 @@ constructor(
|
||||
}
|
||||
overlayOffsets = offsets
|
||||
|
||||
val lottie = view.findViewById(R.id.sidefps_animation) as LottieAnimationView
|
||||
val lottie = view.requireViewById(R.id.sidefps_animation) as LottieAnimationView
|
||||
view.rotation =
|
||||
display.asSideFpsAnimationRotation(
|
||||
offsets.isYAligned(),
|
||||
|
||||
@@ -38,7 +38,8 @@ class UdfpsFpmEmptyView(
|
||||
override fun getDrawable(): UdfpsDrawable = fingerprintDrawable
|
||||
|
||||
fun updateAccessibilityViewLocation(sensorBounds: Rect) {
|
||||
val fingerprintAccessibilityView: View = findViewById(R.id.udfps_enroll_accessibility_view)
|
||||
val fingerprintAccessibilityView: View =
|
||||
requireViewById(R.id.udfps_enroll_accessibility_view)
|
||||
val params: ViewGroup.LayoutParams = fingerprintAccessibilityView.layoutParams
|
||||
params.width = sensorBounds.width()
|
||||
params.height = sensorBounds.height()
|
||||
|
||||
@@ -33,7 +33,7 @@ constructor(
|
||||
@Main private val resources: Resources,
|
||||
private val keyguardViewManager: StatusBarKeyguardViewManager,
|
||||
) : View.AccessibilityDelegate() {
|
||||
override fun onInitializeAccessibilityNodeInfo(host: View?, info: AccessibilityNodeInfo) {
|
||||
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(host, info)
|
||||
val clickAction =
|
||||
AccessibilityNodeInfo.AccessibilityAction(
|
||||
@@ -43,7 +43,7 @@ constructor(
|
||||
info.addAction(clickAction)
|
||||
}
|
||||
|
||||
override fun performAccessibilityAction(host: View?, action: Int, args: Bundle?): Boolean {
|
||||
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
|
||||
// when an a11y service is enabled, double tapping on the fingerprint sensor should
|
||||
// show the primary bouncer
|
||||
return if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK.id) {
|
||||
|
||||
@@ -306,8 +306,9 @@ constructor(
|
||||
activityLaunchAnimator.addListener(activityLaunchAnimatorListener)
|
||||
view.mUseExpandedOverlay = useExpandedOverlay
|
||||
view.startIconAsyncInflate {
|
||||
(view.findViewById(R.id.udfps_animation_view_internal) as View).accessibilityDelegate =
|
||||
udfpsKeyguardAccessibilityDelegate
|
||||
val animationViewInternal: View =
|
||||
view.requireViewById(R.id.udfps_animation_view_internal)
|
||||
animationViewInternal.accessibilityDelegate = udfpsKeyguardAccessibilityDelegate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ constructor(
|
||||
)
|
||||
val hat = gkResponse.gatekeeperHAT
|
||||
lockPatternUtils.removeGatekeeperPasswordHandle(pwHandle)
|
||||
emit(CredentialStatus.Success.Verified(hat))
|
||||
emit(CredentialStatus.Success.Verified(checkNotNull(hat)))
|
||||
} else if (response.timeout > 0) {
|
||||
// if requests are being throttled, update the error message every
|
||||
// second until the temporary lock has expired
|
||||
@@ -226,8 +226,7 @@ private fun Context.getLastAttemptBeforeWipeProfileMessage(
|
||||
is BiometricPromptRequest.Credential.Password ->
|
||||
DevicePolicyResources.Strings.SystemUi.BIOMETRIC_DIALOG_WORK_PASSWORD_LAST_ATTEMPT
|
||||
}
|
||||
return devicePolicyManager.resources.getString(id) {
|
||||
// use fallback a string if not found
|
||||
val getFallbackString = {
|
||||
val defaultId =
|
||||
when (request) {
|
||||
is BiometricPromptRequest.Credential.Pin ->
|
||||
@@ -239,6 +238,8 @@ private fun Context.getLastAttemptBeforeWipeProfileMessage(
|
||||
}
|
||||
getString(defaultId)
|
||||
}
|
||||
|
||||
return devicePolicyManager.resources?.getString(id, getFallbackString) ?: getFallbackString()
|
||||
}
|
||||
|
||||
private fun Context.getLastAttemptBeforeWipeUserMessage(
|
||||
@@ -266,8 +267,8 @@ private fun Context.getNowWipingMessage(
|
||||
DevicePolicyResources.Strings.SystemUi.BIOMETRIC_DIALOG_WORK_LOCK_FAILED_ATTEMPTS
|
||||
else -> DevicePolicyResources.UNDEFINED
|
||||
}
|
||||
return devicePolicyManager.resources.getString(id) {
|
||||
// use fallback a string if not found
|
||||
|
||||
val getFallbackString = {
|
||||
val defaultId =
|
||||
when (userType) {
|
||||
UserType.PRIMARY ->
|
||||
@@ -279,4 +280,6 @@ private fun Context.getNowWipingMessage(
|
||||
}
|
||||
getString(defaultId)
|
||||
}
|
||||
|
||||
return devicePolicyManager.resources?.getString(id, getFallbackString) ?: getFallbackString()
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class CredentialPasswordView(context: Context, attrs: AttributeSet?) :
|
||||
titleView.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
titleView.marqueeRepeatLimit = -1
|
||||
// select to enable marquee unless a screen reader is enabled
|
||||
titleView.isSelected = accessibilityManager.shouldMarquee()
|
||||
titleView.isSelected = accessibilityManager?.shouldMarquee() ?: false
|
||||
} else {
|
||||
titleView.isSingleLine = false
|
||||
titleView.ellipsize = null
|
||||
|
||||
@@ -85,9 +85,9 @@ object BiometricViewBinder {
|
||||
val textColorHint =
|
||||
view.resources.getColor(R.color.biometric_dialog_gray, view.context.theme)
|
||||
|
||||
val titleView = view.findViewById<TextView>(R.id.title)
|
||||
val subtitleView = view.findViewById<TextView>(R.id.subtitle)
|
||||
val descriptionView = view.findViewById<TextView>(R.id.description)
|
||||
val titleView = view.requireViewById<TextView>(R.id.title)
|
||||
val subtitleView = view.requireViewById<TextView>(R.id.subtitle)
|
||||
val descriptionView = view.requireViewById<TextView>(R.id.description)
|
||||
|
||||
// set selected to enable marquee unless a screen reader is enabled
|
||||
titleView.isSelected =
|
||||
@@ -96,18 +96,18 @@ object BiometricViewBinder {
|
||||
!accessibilityManager.isEnabled || !accessibilityManager.isTouchExplorationEnabled
|
||||
descriptionView.movementMethod = ScrollingMovementMethod()
|
||||
|
||||
val iconViewOverlay = view.findViewById<LottieAnimationView>(R.id.biometric_icon_overlay)
|
||||
val iconView = view.findViewById<LottieAnimationView>(R.id.biometric_icon)
|
||||
val indicatorMessageView = view.findViewById<TextView>(R.id.indicator)
|
||||
val iconViewOverlay = view.requireViewById<LottieAnimationView>(R.id.biometric_icon_overlay)
|
||||
val iconView = view.requireViewById<LottieAnimationView>(R.id.biometric_icon)
|
||||
val indicatorMessageView = view.requireViewById<TextView>(R.id.indicator)
|
||||
|
||||
// Negative-side (left) buttons
|
||||
val negativeButton = view.findViewById<Button>(R.id.button_negative)
|
||||
val cancelButton = view.findViewById<Button>(R.id.button_cancel)
|
||||
val credentialFallbackButton = view.findViewById<Button>(R.id.button_use_credential)
|
||||
val negativeButton = view.requireViewById<Button>(R.id.button_negative)
|
||||
val cancelButton = view.requireViewById<Button>(R.id.button_cancel)
|
||||
val credentialFallbackButton = view.requireViewById<Button>(R.id.button_use_credential)
|
||||
|
||||
// Positive-side (right) buttons
|
||||
val confirmationButton = view.findViewById<Button>(R.id.button_confirm)
|
||||
val retryButton = view.findViewById<Button>(R.id.button_try_again)
|
||||
val confirmationButton = view.requireViewById<Button>(R.id.button_confirm)
|
||||
val retryButton = view.requireViewById<Button>(R.id.button_try_again)
|
||||
|
||||
// TODO(b/251476085): temporary workaround for the unsafe callbacks & legacy controllers
|
||||
val adapter =
|
||||
|
||||
@@ -72,7 +72,7 @@ object BiometricViewSizeBinder {
|
||||
}
|
||||
}
|
||||
|
||||
val iconHolderView = view.findViewById<View>(R.id.biometric_icon_frame)
|
||||
val iconHolderView = view.requireViewById<View>(R.id.biometric_icon_frame)
|
||||
val iconPadding = view.resources.getDimension(R.dimen.biometric_dialog_icon_padding)
|
||||
val fullSizeYOffset =
|
||||
view.resources.getDimension(R.dimen.biometric_dialog_medium_to_large_translation_offset)
|
||||
@@ -205,7 +205,7 @@ object BiometricViewSizeBinder {
|
||||
}
|
||||
|
||||
private fun View.isLandscape(): Boolean {
|
||||
val r = context.display.rotation
|
||||
val r = context.display?.rotation
|
||||
return r == Surface.ROTATION_90 || r == Surface.ROTATION_270
|
||||
}
|
||||
|
||||
|
||||
@@ -156,9 +156,9 @@ class WiredChargingRippleController @Inject constructor(
|
||||
}
|
||||
windowLayoutParams.packageName = context.opPackageName
|
||||
rippleView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
||||
override fun onViewDetachedFromWindow(view: View?) {}
|
||||
override fun onViewDetachedFromWindow(view: View) {}
|
||||
|
||||
override fun onViewAttachedToWindow(view: View?) {
|
||||
override fun onViewAttachedToWindow(view: View) {
|
||||
layoutRipple()
|
||||
rippleView.startRipple(Runnable {
|
||||
windowManager.removeView(rippleView)
|
||||
@@ -176,7 +176,7 @@ class WiredChargingRippleController @Inject constructor(
|
||||
val height = bounds.height()
|
||||
val maxDiameter = Integer.max(width, height) * 2f
|
||||
rippleView.setMaxSize(maxDiameter, maxDiameter)
|
||||
when (context.display.rotation) {
|
||||
when (context.display?.rotation) {
|
||||
Surface.ROTATION_0 -> {
|
||||
rippleView.setCenter(
|
||||
width * normalizedPortPosX, height * normalizedPortPosY)
|
||||
|
||||
@@ -29,7 +29,7 @@ import javax.inject.Inject
|
||||
*/
|
||||
class FalsingA11yDelegate @Inject constructor(private val falsingCollector: FalsingCollector) :
|
||||
View.AccessibilityDelegate() {
|
||||
override fun performAccessibilityAction(host: View?, action: Int, args: Bundle?): Boolean {
|
||||
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
|
||||
if (action == ACTION_CLICK) {
|
||||
falsingCollector.onA11yAction()
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ constructor(
|
||||
.stateIn(scope, SharingStarted.WhileSubscribed(), getResolutionScale())
|
||||
|
||||
override fun getResolutionScale(): Float {
|
||||
context.display.getDisplayInfo(displayInfo.value)
|
||||
context.display?.getDisplayInfo(displayInfo.value)
|
||||
val maxDisplayMode =
|
||||
displayUtils.getMaximumResolutionDisplayMode(displayInfo.value.supportedModes)
|
||||
maxDisplayMode?.let {
|
||||
|
||||
@@ -66,9 +66,9 @@ class ContrastDialog(
|
||||
|
||||
contrastButtons =
|
||||
mapOf(
|
||||
CONTRAST_LEVEL_STANDARD to findViewById(R.id.contrast_button_standard),
|
||||
CONTRAST_LEVEL_MEDIUM to findViewById(R.id.contrast_button_medium),
|
||||
CONTRAST_LEVEL_HIGH to findViewById(R.id.contrast_button_high)
|
||||
CONTRAST_LEVEL_STANDARD to requireViewById(R.id.contrast_button_standard),
|
||||
CONTRAST_LEVEL_MEDIUM to requireViewById(R.id.contrast_button_medium),
|
||||
CONTRAST_LEVEL_HIGH to requireViewById(R.id.contrast_button_high)
|
||||
)
|
||||
|
||||
contrastButtons.forEach { (contrastLevel, contrastButton) ->
|
||||
|
||||
@@ -190,7 +190,7 @@ class ControlsControllerImpl @Inject constructor (
|
||||
PREFS_CONTROLS_SEEDING_COMPLETED, mutableSetOf<String>())
|
||||
val servicePackageSet = serviceInfoSet.map { it.packageName }
|
||||
prefs.edit().putStringSet(PREFS_CONTROLS_SEEDING_COMPLETED,
|
||||
completedSeedingPackageSet.intersect(servicePackageSet)).apply()
|
||||
completedSeedingPackageSet?.intersect(servicePackageSet) ?: emptySet()).apply()
|
||||
|
||||
var changed = false
|
||||
favoriteComponentSet.subtract(serviceInfoSet).forEach {
|
||||
|
||||
@@ -193,7 +193,7 @@ open class ControlsFavoritingActivity @Inject constructor(
|
||||
|
||||
ControlsAnimations.enterAnimation(pageIndicator).apply {
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
// Position the tooltip if necessary after animations are complete
|
||||
// so we can get the position on screen. The tooltip is not
|
||||
// rooted in the layout root.
|
||||
|
||||
@@ -106,10 +106,8 @@ object ChallengeDialogs {
|
||||
}
|
||||
)
|
||||
|
||||
getWindow().apply {
|
||||
setType(WINDOW_TYPE)
|
||||
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
||||
}
|
||||
window?.setType(WINDOW_TYPE)
|
||||
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
||||
setOnShowListener(DialogInterface.OnShowListener { _ ->
|
||||
val editText = requireViewById<EditText>(R.id.controls_pin_input)
|
||||
editText.setHint(instructions)
|
||||
@@ -153,9 +151,7 @@ object ChallengeDialogs {
|
||||
)
|
||||
}
|
||||
return builder.create().apply {
|
||||
getWindow().apply {
|
||||
setType(WINDOW_TYPE)
|
||||
}
|
||||
window?.setType(WINDOW_TYPE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ class ControlViewHolder(
|
||||
)
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
stateAnimator = null
|
||||
}
|
||||
})
|
||||
@@ -438,7 +438,7 @@ class ControlViewHolder(
|
||||
duration = 200L
|
||||
interpolator = Interpolators.LINEAR
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
statusRowUpdater.invoke()
|
||||
}
|
||||
})
|
||||
@@ -450,7 +450,7 @@ class ControlViewHolder(
|
||||
statusAnimator = AnimatorSet().apply {
|
||||
playSequentially(fadeOut, fadeIn)
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
status.alpha = STATUS_ALPHA_ENABLED
|
||||
statusAnimator = null
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ class DetailDialog(
|
||||
|
||||
init {
|
||||
// To pass touches to the task inside TaskView.
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)
|
||||
window.addPrivateFlags(WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY)
|
||||
window?.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)
|
||||
window?.addPrivateFlags(WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY)
|
||||
|
||||
setContentView(R.layout.controls_detail_dialog)
|
||||
|
||||
@@ -182,7 +182,7 @@ class DetailDialog(
|
||||
}
|
||||
|
||||
// consume all insets to achieve slide under effect
|
||||
window.getDecorView().setOnApplyWindowInsetsListener {
|
||||
checkNotNull(window).decorView.setOnApplyWindowInsetsListener {
|
||||
v: View, insets: WindowInsets ->
|
||||
val l = v.getPaddingLeft()
|
||||
val r = v.getPaddingRight()
|
||||
@@ -202,7 +202,7 @@ class DetailDialog(
|
||||
}
|
||||
|
||||
fun getTaskViewBounds(): Rect {
|
||||
val wm = context.getSystemService(WindowManager::class.java)
|
||||
val wm = checkNotNull(context.getSystemService(WindowManager::class.java))
|
||||
val windowMetrics = wm.getCurrentWindowMetrics()
|
||||
val rect = windowMetrics.bounds
|
||||
val metricInsets = windowMetrics.windowInsets
|
||||
|
||||
@@ -67,7 +67,8 @@ data class RenderInfo(
|
||||
iconMap.put(resourceId, icon)
|
||||
}
|
||||
}
|
||||
return RenderInfo(icon!!.constantState.newDrawable(context.resources), fg, bg)
|
||||
return RenderInfo(
|
||||
checkNotNull(icon?.constantState).newDrawable(context.resources), fg, bg)
|
||||
}
|
||||
|
||||
fun registerComponentIcon(componentName: ComponentName, icon: Drawable) {
|
||||
|
||||
@@ -94,10 +94,8 @@ class StatusBehavior : Behavior {
|
||||
)
|
||||
}
|
||||
cvh.visibleDialog = builder.create().apply {
|
||||
getWindow().apply {
|
||||
setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY)
|
||||
show()
|
||||
}
|
||||
window?.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY)
|
||||
show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class ToggleRangeBehavior : Behavior {
|
||||
cvh.clipLayer.level = it.animatedValue as Int
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
rangeAnimator = null
|
||||
}
|
||||
})
|
||||
@@ -335,7 +335,7 @@ class ToggleRangeBehavior : Behavior {
|
||||
}
|
||||
|
||||
override fun onScroll(
|
||||
e1: MotionEvent,
|
||||
e1: MotionEvent?,
|
||||
e2: MotionEvent,
|
||||
xDiff: Float,
|
||||
yDiff: Float
|
||||
|
||||
@@ -51,7 +51,7 @@ constructor(
|
||||
val callback =
|
||||
object : ConfigurationController.ConfigurationListener {
|
||||
override fun onConfigChanged(newConfig: Configuration?) {
|
||||
context.display.getMetrics(displayMetricsHolder)
|
||||
context.display?.getMetrics(displayMetricsHolder)
|
||||
trySend(displayMetricsHolder)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class KeyboardBacklightDialog(
|
||||
}
|
||||
|
||||
private fun updateIconTile() {
|
||||
val iconTile = rootView.findViewById(BACKLIGHT_ICON_ID) as ImageView
|
||||
val iconTile = rootView.requireViewById(BACKLIGHT_ICON_ID) as ImageView
|
||||
val backgroundDrawable = iconTile.background as ShapeDrawable
|
||||
if (currentLevel == 0) {
|
||||
iconTile.setColorFilter(dimmedIconColor)
|
||||
|
||||
@@ -59,7 +59,7 @@ constructor(
|
||||
conflatedCallbackFlow {
|
||||
val callback =
|
||||
object : QuickAccessWalletClient.OnWalletCardsRetrievedCallback {
|
||||
override fun onWalletCardsRetrieved(response: GetWalletCardsResponse?) {
|
||||
override fun onWalletCardsRetrieved(response: GetWalletCardsResponse) {
|
||||
val hasCards = response?.walletCards?.isNotEmpty() == true
|
||||
trySendWithFailureLogging(
|
||||
state(
|
||||
@@ -71,7 +71,7 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
override fun onWalletCardRetrievalError(error: GetWalletCardsError?) {
|
||||
override fun onWalletCardRetrievalError(error: GetWalletCardsError) {
|
||||
Log.e(TAG, "Wallet card retrieval error, message: \"${error?.message}\"")
|
||||
trySendWithFailureLogging(
|
||||
KeyguardQuickAffordanceConfig.LockScreenState.Hidden,
|
||||
@@ -133,13 +133,13 @@ constructor(
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
val callback =
|
||||
object : QuickAccessWalletClient.OnWalletCardsRetrievedCallback {
|
||||
override fun onWalletCardsRetrieved(response: GetWalletCardsResponse?) {
|
||||
override fun onWalletCardsRetrieved(response: GetWalletCardsResponse) {
|
||||
continuation.resumeWith(
|
||||
Result.success(response?.walletCards ?: emptyList())
|
||||
)
|
||||
}
|
||||
|
||||
override fun onWalletCardRetrievalError(error: GetWalletCardsError?) {
|
||||
override fun onWalletCardRetrievalError(error: GetWalletCardsError) {
|
||||
continuation.resumeWith(Result.success(emptyList()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ constructor(
|
||||
// We always want to invoke face detect in the main thread.
|
||||
faceAuthLogger.faceDetectionStarted()
|
||||
faceManager?.detectFace(
|
||||
detectCancellationSignal,
|
||||
checkNotNull(detectCancellationSignal),
|
||||
detectionCallback,
|
||||
FaceAuthenticateOptions.Builder().setUserId(currentUserId).build()
|
||||
)
|
||||
|
||||
@@ -163,12 +163,13 @@ constructor(
|
||||
|
||||
private fun constructCircleRevealFromPoint(point: Point): LightRevealEffect {
|
||||
return with(point) {
|
||||
val display = checkNotNull(context.display)
|
||||
CircleReveal(
|
||||
x,
|
||||
y,
|
||||
startRadius = 0,
|
||||
endRadius =
|
||||
max(max(x, context.display.width - x), max(y, context.display.height - y)),
|
||||
max(max(x, display.width - x), max(y, display.height - y)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ object KeyguardBottomAreaViewBinder {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onLongClickUseDefaultHapticFeedback(view: View?) = false
|
||||
override fun onLongClickUseDefaultHapticFeedback(view: View) = false
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated as part of b/278057014")
|
||||
|
||||
@@ -304,7 +304,7 @@ object KeyguardQuickAffordanceViewBinder {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onLongClickUseDefaultHapticFeedback(view: View?) = false
|
||||
override fun onLongClickUseDefaultHapticFeedback(view: View) = false
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ object KeyguardSettingsViewBinder {
|
||||
vibratorHelper: VibratorHelper,
|
||||
activityStarter: ActivityStarter
|
||||
): DisposableHandle {
|
||||
val view = parentView.findViewById<LaunchableLinearLayout>(R.id.keyguard_settings_button)
|
||||
val view = parentView.requireViewById<LaunchableLinearLayout>(R.id.keyguard_settings_button)
|
||||
|
||||
val disposableHandle =
|
||||
view.repeatWhenAttached {
|
||||
|
||||
@@ -42,13 +42,13 @@ object UdfpsKeyguardInternalViewBinder {
|
||||
view.accessibilityDelegate = viewModel.accessibilityDelegate
|
||||
|
||||
// bind child views
|
||||
UdfpsAodFingerprintViewBinder.bind(view.findViewById(R.id.udfps_aod_fp), aodViewModel)
|
||||
UdfpsAodFingerprintViewBinder.bind(view.requireViewById(R.id.udfps_aod_fp), aodViewModel)
|
||||
UdfpsFingerprintViewBinder.bind(
|
||||
view.findViewById(R.id.udfps_lockscreen_fp),
|
||||
view.requireViewById(R.id.udfps_lockscreen_fp),
|
||||
fingerprintViewModel
|
||||
)
|
||||
UdfpsBackgroundViewBinder.bind(
|
||||
view.findViewById(R.id.udfps_keyguard_fp_bg),
|
||||
view.requireViewById(R.id.udfps_keyguard_fp_bg),
|
||||
backgroundViewModel
|
||||
)
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ constructor(
|
||||
private var host: SurfaceControlViewHost
|
||||
|
||||
val surfacePackage: SurfaceControlViewHost.SurfacePackage
|
||||
get() = host.surfacePackage
|
||||
get() = checkNotNull(host.surfacePackage)
|
||||
|
||||
private lateinit var largeClockHostView: FrameLayout
|
||||
private lateinit var smallClockHostView: FrameLayout
|
||||
|
||||
@@ -70,7 +70,7 @@ fun View.repeatWhenAttached(
|
||||
var lifecycleOwner: ViewLifecycleOwner? = null
|
||||
val onAttachListener =
|
||||
object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View?) {
|
||||
override fun onViewAttachedToWindow(v: View) {
|
||||
Assert.isMainThread()
|
||||
lifecycleOwner?.onDestroy()
|
||||
lifecycleOwner =
|
||||
@@ -81,7 +81,7 @@ fun View.repeatWhenAttached(
|
||||
)
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(v: View?) {
|
||||
override fun onViewDetachedFromWindow(v: View) {
|
||||
lifecycleOwner?.onDestroy()
|
||||
lifecycleOwner = null
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ constructor(
|
||||
* Returns true when the down event of the scroll hits within the target box of the thumb.
|
||||
*/
|
||||
override fun onScroll(
|
||||
eventStart: MotionEvent,
|
||||
eventStart: MotionEvent?,
|
||||
event: MotionEvent,
|
||||
distanceX: Float,
|
||||
distanceY: Float
|
||||
@@ -528,7 +528,7 @@ constructor(
|
||||
* Gestures that include a fling are considered a false gesture on the seek bar.
|
||||
*/
|
||||
override fun onFling(
|
||||
eventStart: MotionEvent,
|
||||
eventStart: MotionEvent?,
|
||||
event: MotionEvent,
|
||||
velocityX: Float,
|
||||
velocityY: Float
|
||||
|
||||
@@ -149,11 +149,7 @@ constructor(
|
||||
// Check if smartspace has explicitly specified whether to re-activate resumable media.
|
||||
// The default behavior is to trigger if the smartspace data is active.
|
||||
val shouldTriggerResume =
|
||||
if (data.cardAction?.extras?.containsKey(EXTRA_KEY_TRIGGER_RESUME) == true) {
|
||||
data.cardAction.extras.getBoolean(EXTRA_KEY_TRIGGER_RESUME, true)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
data.cardAction?.extras?.getBoolean(EXTRA_KEY_TRIGGER_RESUME, true) ?: true
|
||||
val shouldReactivate =
|
||||
shouldTriggerResume && !hasActiveMedia() && hasAnyMedia() && data.isActive
|
||||
|
||||
@@ -269,9 +265,7 @@ constructor(
|
||||
"Cannot create dismiss action click action: extras missing dismiss_intent."
|
||||
)
|
||||
} else if (
|
||||
dismissIntent.getComponent() != null &&
|
||||
dismissIntent.getComponent().getClassName() ==
|
||||
EXPORTED_SMARTSPACE_TRAMPOLINE_ACTIVITY_NAME
|
||||
dismissIntent.component?.className == EXPORTED_SMARTSPACE_TRAMPOLINE_ACTIVITY_NAME
|
||||
) {
|
||||
// Dismiss the card Smartspace data through Smartspace trampoline activity.
|
||||
context.startActivity(dismissIntent)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.app.Notification
|
||||
import android.app.Notification.EXTRA_SUBSTITUTE_APP_NAME
|
||||
import android.app.PendingIntent
|
||||
import android.app.StatusBarManager
|
||||
import android.app.smartspace.SmartspaceAction
|
||||
import android.app.smartspace.SmartspaceConfig
|
||||
import android.app.smartspace.SmartspaceManager
|
||||
import android.app.smartspace.SmartspaceSession
|
||||
@@ -1623,20 +1624,18 @@ class MediaDataManager(
|
||||
* SmartspaceTarget's data is invalid.
|
||||
*/
|
||||
private fun toSmartspaceMediaData(target: SmartspaceTarget): SmartspaceMediaData {
|
||||
var dismissIntent: Intent? = null
|
||||
if (target.baseAction != null && target.baseAction.extras != null) {
|
||||
dismissIntent =
|
||||
target.baseAction.extras.getParcelable(EXTRAS_SMARTSPACE_DISMISS_INTENT_KEY)
|
||||
as Intent?
|
||||
}
|
||||
val baseAction: SmartspaceAction? = target.baseAction
|
||||
val dismissIntent =
|
||||
baseAction?.extras?.getParcelable(EXTRAS_SMARTSPACE_DISMISS_INTENT_KEY) as Intent?
|
||||
|
||||
val isActive =
|
||||
when {
|
||||
!mediaFlags.isPersistentSsCardEnabled() -> true
|
||||
target.baseAction == null -> true
|
||||
else ->
|
||||
target.baseAction.extras.getString(EXTRA_KEY_TRIGGER_SOURCE) !=
|
||||
EXTRA_VALUE_TRIGGER_PERIODIC
|
||||
baseAction == null -> true
|
||||
else -> {
|
||||
val triggerSource = baseAction.extras?.getString(EXTRA_KEY_TRIGGER_SOURCE)
|
||||
triggerSource != EXTRA_VALUE_TRIGGER_PERIODIC
|
||||
}
|
||||
}
|
||||
|
||||
packageName(target)?.let {
|
||||
|
||||
@@ -65,7 +65,7 @@ constructor(
|
||||
|
||||
private val sessionListener =
|
||||
object : MediaSessionManager.OnActiveSessionsChangedListener {
|
||||
override fun onActiveSessionsChanged(controllers: List<MediaController>) {
|
||||
override fun onActiveSessionsChanged(controllers: List<MediaController>?) {
|
||||
handleControllersChanged(controllers)
|
||||
}
|
||||
}
|
||||
@@ -190,16 +190,18 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleControllersChanged(controllers: List<MediaController>) {
|
||||
private fun handleControllersChanged(controllers: List<MediaController>?) {
|
||||
packageControllers.clear()
|
||||
controllers.forEach { controller ->
|
||||
controllers?.forEach { controller ->
|
||||
packageControllers.get(controller.packageName)?.let { tokens -> tokens.add(controller) }
|
||||
?: run {
|
||||
val tokens = mutableListOf(controller)
|
||||
packageControllers.put(controller.packageName, tokens)
|
||||
}
|
||||
}
|
||||
tokensWithNotifications.retainAll(controllers.map { TokenId(it.sessionToken) })
|
||||
controllers?.map { TokenId(it.sessionToken) }?.let {
|
||||
tokensWithNotifications.retainAll(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -195,7 +195,7 @@ class IlluminationDrawable : Drawable() {
|
||||
}
|
||||
addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
backgroundAnimation = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ class LightSourceDrawable : Drawable() {
|
||||
addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
var cancelled = false
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
cancelled = true
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
if (cancelled) {
|
||||
return
|
||||
}
|
||||
@@ -226,7 +226,7 @@ class LightSourceDrawable : Drawable() {
|
||||
)
|
||||
addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
rippleData.progress = 0f
|
||||
rippleAnimation = null
|
||||
invalidateSelf()
|
||||
@@ -270,11 +270,8 @@ class LightSourceDrawable : Drawable() {
|
||||
return bounds
|
||||
}
|
||||
|
||||
override fun onStateChange(stateSet: IntArray?): Boolean {
|
||||
override fun onStateChange(stateSet: IntArray): Boolean {
|
||||
val changed = super.onStateChange(stateSet)
|
||||
if (stateSet == null) {
|
||||
return changed
|
||||
}
|
||||
|
||||
val wasPressed = pressed
|
||||
var enabled = false
|
||||
|
||||
@@ -127,19 +127,19 @@ class MediaCarouselScrollHandler(
|
||||
object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onFling(
|
||||
eStart: MotionEvent?,
|
||||
eCurrent: MotionEvent?,
|
||||
eCurrent: MotionEvent,
|
||||
vX: Float,
|
||||
vY: Float
|
||||
) = onFling(vX, vY)
|
||||
|
||||
override fun onScroll(
|
||||
down: MotionEvent?,
|
||||
lastMotion: MotionEvent?,
|
||||
lastMotion: MotionEvent,
|
||||
distanceX: Float,
|
||||
distanceY: Float
|
||||
) = onScroll(down!!, lastMotion!!, distanceX)
|
||||
) = onScroll(down!!, lastMotion, distanceX)
|
||||
|
||||
override fun onDown(e: MotionEvent?): Boolean {
|
||||
override fun onDown(e: MotionEvent): Boolean {
|
||||
if (falsingProtectionNeeded) {
|
||||
falsingCollector.onNotificationStartDismissing()
|
||||
}
|
||||
|
||||
@@ -180,20 +180,20 @@ constructor(
|
||||
object : AnimatorListenerAdapter() {
|
||||
private var cancelled: Boolean = false
|
||||
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
cancelled = true
|
||||
animationPending = false
|
||||
rootView?.removeCallbacks(startAnimation)
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
isCrossFadeAnimatorRunning = false
|
||||
if (!cancelled) {
|
||||
applyTargetStateIfNotAnimating()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
cancelled = false
|
||||
animationPending = false
|
||||
}
|
||||
@@ -606,7 +606,7 @@ constructor(
|
||||
val viewHost = UniqueObjectHostView(context)
|
||||
viewHost.addOnAttachStateChangeListener(
|
||||
object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(p0: View?) {
|
||||
override fun onViewAttachedToWindow(p0: View) {
|
||||
if (rootOverlay == null) {
|
||||
rootView = viewHost.viewRootImpl.view
|
||||
rootOverlay = (rootView!!.overlay as ViewGroupOverlay)
|
||||
@@ -614,7 +614,7 @@ constructor(
|
||||
viewHost.removeOnAttachStateChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(p0: View?) {}
|
||||
override fun onViewDetachedFromWindow(p0: View) {}
|
||||
}
|
||||
)
|
||||
return viewHost
|
||||
|
||||
@@ -144,12 +144,12 @@ constructor(
|
||||
setListeningToMediaData(true)
|
||||
hostView.addOnAttachStateChangeListener(
|
||||
object : OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View?) {
|
||||
override fun onViewAttachedToWindow(v: View) {
|
||||
setListeningToMediaData(true)
|
||||
updateViewVisibility()
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(v: View?) {
|
||||
override fun onViewDetachedFromWindow(v: View) {
|
||||
setListeningToMediaData(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class SquigglyProgress : Drawable() {
|
||||
}
|
||||
addListener(
|
||||
object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
heightAnimator = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,13 +201,13 @@ open class MediaTttChipControllerReceiver @Inject constructor(
|
||||
}
|
||||
|
||||
override fun updateView(newInfo: ChipReceiverInfo, currentView: ViewGroup) {
|
||||
val packageName = newInfo.routeInfo.clientPackageName
|
||||
val packageName: String? = newInfo.routeInfo.clientPackageName
|
||||
var iconInfo = MediaTttUtils.getIconInfoFromPackageName(
|
||||
context,
|
||||
packageName,
|
||||
isReceiver = true,
|
||||
) {
|
||||
logger.logPackageNotFound(packageName)
|
||||
packageName?.let { logger.logPackageNotFound(it) }
|
||||
}
|
||||
|
||||
if (newInfo.appNameOverride != null) {
|
||||
|
||||
@@ -68,9 +68,9 @@ constructor(
|
||||
)
|
||||
rippleView.addOnAttachStateChangeListener(
|
||||
object : View.OnAttachStateChangeListener {
|
||||
override fun onViewDetachedFromWindow(view: View?) {}
|
||||
override fun onViewDetachedFromWindow(view: View) {}
|
||||
|
||||
override fun onViewAttachedToWindow(view: View?) {
|
||||
override fun onViewAttachedToWindow(view: View) {
|
||||
if (view == null) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi
|
||||
// Reset all listeners to animator.
|
||||
animator.removeAllListeners()
|
||||
animator.addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
onAnimationEnd?.run()
|
||||
isStarted = false
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi
|
||||
invalidate()
|
||||
}
|
||||
animator.addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
animation?.let { visibility = GONE }
|
||||
onAnimationEnd?.run()
|
||||
isStarted = false
|
||||
|
||||
@@ -162,7 +162,7 @@ constructor(
|
||||
logger: MediaTttSenderLogger,
|
||||
instanceId: InstanceId,
|
||||
): ChipbarInfo {
|
||||
val packageName = routeInfo.clientPackageName
|
||||
val packageName = checkNotNull(routeInfo.clientPackageName)
|
||||
val otherDeviceName =
|
||||
if (routeInfo.name.isBlank()) {
|
||||
context.getString(R.string.media_ttt_default_device_type)
|
||||
|
||||
@@ -88,7 +88,7 @@ constructor(
|
||||
.inflate(R.layout.media_projection_recent_tasks, parent, /* attachToRoot= */ false)
|
||||
as ViewGroup
|
||||
|
||||
val container = recentsRoot.findViewById<View>(R.id.media_projection_recent_tasks_container)
|
||||
val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container)
|
||||
container.setTaskHeightSize()
|
||||
|
||||
val progress = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_loader)
|
||||
|
||||
@@ -81,8 +81,8 @@ constructor(
|
||||
return MediaProjectionState.EntireScreen
|
||||
}
|
||||
val matchingTask =
|
||||
tasksRepository.findRunningTaskFromWindowContainerToken(session.tokenToRecord)
|
||||
?: return MediaProjectionState.EntireScreen
|
||||
tasksRepository.findRunningTaskFromWindowContainerToken(
|
||||
checkNotNull(session.tokenToRecord)) ?: return MediaProjectionState.EntireScreen
|
||||
return MediaProjectionState.SingleTask(matchingTask)
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,13 @@ internal object NoteTaskRoleManagerExt {
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun PackageManager.getApplicationLabel(packageName: String?): String? =
|
||||
runCatching { getApplicationInfo(packageName, /* flags= */ 0)!! }
|
||||
private fun PackageManager.getApplicationLabel(packageName: String?): String? {
|
||||
if (packageName == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return runCatching { getApplicationInfo(packageName, /* flags= */ 0)!! }
|
||||
.getOrNull()
|
||||
?.let { info -> getApplicationLabel(info).toString() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,13 +132,13 @@ object PeopleViewBinder {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.people_space_activity_no_conversations, /* root= */ view)
|
||||
|
||||
noConversationsView.findViewById<View>(R.id.got_it_button).setOnClickListener {
|
||||
noConversationsView.requireViewById<View>(R.id.got_it_button).setOnClickListener {
|
||||
onGotItClicked()
|
||||
}
|
||||
|
||||
// The Tile preview has colorBackground as its background. Change it so it's different than
|
||||
// the activity's background.
|
||||
val item = noConversationsView.findViewById<LinearLayout>(android.R.id.background)
|
||||
val item = noConversationsView.requireViewById<LinearLayout>(android.R.id.background)
|
||||
val shape = item.background as GradientDrawable
|
||||
val ta =
|
||||
context.theme.obtainStyledAttributes(
|
||||
|
||||
@@ -192,7 +192,7 @@ class PrivacyDialogV2(
|
||||
return null
|
||||
}
|
||||
val closeAppButton =
|
||||
window.layoutInflater.inflate(
|
||||
checkNotNull(window).layoutInflater.inflate(
|
||||
R.layout.privacy_dialog_card_button,
|
||||
expandedLayout,
|
||||
false
|
||||
@@ -248,7 +248,7 @@ class PrivacyDialogV2(
|
||||
|
||||
private fun configureManageButton(element: PrivacyElement, expandedLayout: ViewGroup): View {
|
||||
val manageButton =
|
||||
window.layoutInflater.inflate(
|
||||
checkNotNull(window).layoutInflater.inflate(
|
||||
R.layout.privacy_dialog_card_button,
|
||||
expandedLayout,
|
||||
false
|
||||
|
||||
@@ -50,22 +50,20 @@ open class BaseScreenSharePermissionDialog(
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
window.apply {
|
||||
addPrivateFlags(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS)
|
||||
setGravity(Gravity.CENTER)
|
||||
}
|
||||
window?.addPrivateFlags(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS)
|
||||
window?.setGravity(Gravity.CENTER)
|
||||
setContentView(R.layout.screen_share_dialog)
|
||||
dialogTitle = findViewById(R.id.screen_share_dialog_title)
|
||||
warning = findViewById(R.id.text_warning)
|
||||
startButton = findViewById(android.R.id.button1)
|
||||
cancelButton = findViewById(android.R.id.button2)
|
||||
dialogTitle = requireViewById(R.id.screen_share_dialog_title)
|
||||
warning = requireViewById(R.id.text_warning)
|
||||
startButton = requireViewById(android.R.id.button1)
|
||||
cancelButton = requireViewById(android.R.id.button2)
|
||||
updateIcon()
|
||||
initScreenShareOptions()
|
||||
createOptionsView(getOptionsViewLayoutId())
|
||||
}
|
||||
|
||||
private fun updateIcon() {
|
||||
val icon = findViewById<ImageView>(R.id.screen_share_dialog_icon)
|
||||
val icon = requireViewById<ImageView>(R.id.screen_share_dialog_icon)
|
||||
if (dialogIconTint != null) {
|
||||
icon.setColorFilter(context.getColor(dialogIconTint))
|
||||
}
|
||||
@@ -92,7 +90,7 @@ open class BaseScreenSharePermissionDialog(
|
||||
options
|
||||
)
|
||||
adapter.setDropDownViewResource(R.layout.screen_share_dialog_spinner_item_text)
|
||||
screenShareModeSpinner = findViewById(R.id.screen_share_mode_spinner)
|
||||
screenShareModeSpinner = requireViewById(R.id.screen_share_mode_spinner)
|
||||
screenShareModeSpinner.adapter = adapter
|
||||
screenShareModeSpinner.onItemSelectedListener = this
|
||||
}
|
||||
|
||||
@@ -100,11 +100,11 @@ class ScreenRecordPermissionDialog(
|
||||
@LayoutRes override fun getOptionsViewLayoutId(): Int = R.layout.screen_record_options
|
||||
|
||||
private fun initRecordOptionsView() {
|
||||
audioSwitch = findViewById(R.id.screenrecord_audio_switch)
|
||||
tapsSwitch = findViewById(R.id.screenrecord_taps_switch)
|
||||
tapsView = findViewById(R.id.show_taps)
|
||||
audioSwitch = requireViewById(R.id.screenrecord_audio_switch)
|
||||
tapsSwitch = requireViewById(R.id.screenrecord_taps_switch)
|
||||
tapsView = requireViewById(R.id.show_taps)
|
||||
updateTapsViewVisibility()
|
||||
options = findViewById(R.id.screen_recording_options)
|
||||
options = requireViewById(R.id.screen_recording_options)
|
||||
val a: ArrayAdapter<*> =
|
||||
ScreenRecordingAdapter(context, android.R.layout.simple_spinner_dropdown_item, MODES)
|
||||
a.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
|
||||
@@ -130,12 +130,12 @@ constructor(
|
||||
private lateinit var carrierIconSlots: List<String>
|
||||
private lateinit var mShadeCarrierGroupController: ShadeCarrierGroupController
|
||||
|
||||
private val batteryIcon: BatteryMeterView = header.findViewById(R.id.batteryRemainingIcon)
|
||||
private val clock: Clock = header.findViewById(R.id.clock)
|
||||
private val date: TextView = header.findViewById(R.id.date)
|
||||
private val iconContainer: StatusIconContainer = header.findViewById(R.id.statusIcons)
|
||||
private val mShadeCarrierGroup: ShadeCarrierGroup = header.findViewById(R.id.carrier_group)
|
||||
private val systemIcons: View = header.findViewById(R.id.shade_header_system_icons)
|
||||
private val batteryIcon: BatteryMeterView = header.requireViewById(R.id.batteryRemainingIcon)
|
||||
private val clock: Clock = header.requireViewById(R.id.clock)
|
||||
private val date: TextView = header.requireViewById(R.id.date)
|
||||
private val iconContainer: StatusIconContainer = header.requireViewById(R.id.statusIcons)
|
||||
private val mShadeCarrierGroup: ShadeCarrierGroup = header.requireViewById(R.id.carrier_group)
|
||||
private val systemIcons: View = header.requireViewById(R.id.shade_header_system_icons)
|
||||
|
||||
private var roundedCorners = 0
|
||||
private var cutout: DisplayCutout? = null
|
||||
@@ -582,7 +582,7 @@ constructor(
|
||||
inner class CustomizerAnimationListener(
|
||||
private val enteringCustomizing: Boolean,
|
||||
) : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
super.onAnimationEnd(animation)
|
||||
header.animate().setListener(null)
|
||||
if (enteringCustomizing) {
|
||||
@@ -590,7 +590,7 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
super.onAnimationStart(animation)
|
||||
if (!enteringCustomizing) {
|
||||
customizing = false
|
||||
|
||||
@@ -106,7 +106,7 @@ abstract class ShadeViewProviderModule {
|
||||
featureFlags: FeatureFlags,
|
||||
): NotificationShadeWindowView {
|
||||
if (featureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
|
||||
return root.findViewById(R.id.legacy_window_root)
|
||||
return root.requireViewById(R.id.legacy_window_root)
|
||||
}
|
||||
return root as NotificationShadeWindowView?
|
||||
?: throw IllegalStateException("root view not a NotificationShadeWindowView")
|
||||
@@ -118,7 +118,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesNotificationStackScrollLayout(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): NotificationStackScrollLayout {
|
||||
return notificationShadeWindowView.findViewById(R.id.notification_stack_scroller)
|
||||
return notificationShadeWindowView.requireViewById(R.id.notification_stack_scroller)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -153,7 +153,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesNotificationPanelView(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): NotificationPanelView {
|
||||
return notificationShadeWindowView.findViewById(R.id.notification_panel)
|
||||
return notificationShadeWindowView.requireViewById(R.id.notification_panel)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +175,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesLightRevealScrim(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): LightRevealScrim {
|
||||
return notificationShadeWindowView.findViewById(R.id.light_reveal_scrim)
|
||||
return notificationShadeWindowView.requireViewById(R.id.light_reveal_scrim)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -183,7 +183,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesKeyguardRootView(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): KeyguardRootView {
|
||||
return notificationShadeWindowView.findViewById(R.id.keyguard_root_view)
|
||||
return notificationShadeWindowView.requireViewById(R.id.keyguard_root_view)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -191,7 +191,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesSharedNotificationContainer(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): SharedNotificationContainer {
|
||||
return notificationShadeWindowView.findViewById(R.id.shared_notification_container)
|
||||
return notificationShadeWindowView.requireViewById(R.id.shared_notification_container)
|
||||
}
|
||||
|
||||
// TODO(b/277762009): Only allow this view's controller to inject the view. See above.
|
||||
@@ -200,7 +200,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesAuthRippleView(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): AuthRippleView? {
|
||||
return notificationShadeWindowView.findViewById(R.id.auth_ripple)
|
||||
return notificationShadeWindowView.requireViewById(R.id.auth_ripple)
|
||||
}
|
||||
|
||||
// TODO(b/277762009): Only allow this view's controller to inject the view. See above.
|
||||
@@ -212,9 +212,9 @@ abstract class ShadeViewProviderModule {
|
||||
featureFlags: FeatureFlags
|
||||
): LockIconView {
|
||||
if (featureFlags.isEnabled(Flags.MIGRATE_LOCK_ICON)) {
|
||||
return keyguardRootView.findViewById(R.id.lock_icon_view)
|
||||
return keyguardRootView.requireViewById(R.id.lock_icon_view)
|
||||
} else {
|
||||
return notificationPanelView.findViewById(R.id.lock_icon_view)
|
||||
return notificationPanelView.requireViewById(R.id.lock_icon_view)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesTapAgainView(
|
||||
notificationPanelView: NotificationPanelView,
|
||||
): TapAgainView {
|
||||
return notificationPanelView.findViewById(R.id.shade_falsing_tap_again)
|
||||
return notificationPanelView.requireViewById(R.id.shade_falsing_tap_again)
|
||||
}
|
||||
|
||||
// TODO(b/277762009): Only allow this view's controller to inject the view. See above.
|
||||
@@ -233,7 +233,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesNotificationsQuickSettingsContainer(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): NotificationsQuickSettingsContainer {
|
||||
return notificationShadeWindowView.findViewById(R.id.notification_container_parent)
|
||||
return notificationShadeWindowView.requireViewById(R.id.notification_container_parent)
|
||||
}
|
||||
|
||||
// TODO(b/277762009): Only allow this view's controller to inject the view. See above.
|
||||
@@ -243,7 +243,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesShadeHeaderView(
|
||||
notificationShadeWindowView: NotificationShadeWindowView,
|
||||
): MotionLayout {
|
||||
val stub = notificationShadeWindowView.findViewById<ViewStub>(R.id.qs_header_stub)
|
||||
val stub = notificationShadeWindowView.requireViewById<ViewStub>(R.id.qs_header_stub)
|
||||
val layoutId = R.layout.combined_qs_header
|
||||
stub.layoutResource = layoutId
|
||||
return stub.inflate() as MotionLayout
|
||||
@@ -260,7 +260,7 @@ abstract class ShadeViewProviderModule {
|
||||
@SysUISingleton
|
||||
@Named(SHADE_HEADER)
|
||||
fun providesBatteryMeterView(@Named(SHADE_HEADER) view: MotionLayout): BatteryMeterView {
|
||||
return view.findViewById(R.id.batteryRemainingIcon)
|
||||
return view.requireViewById(R.id.batteryRemainingIcon)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -295,7 +295,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesOngoingPrivacyChip(
|
||||
@Named(SHADE_HEADER) header: MotionLayout,
|
||||
): OngoingPrivacyChip {
|
||||
return header.findViewById(R.id.privacy_chip)
|
||||
return header.requireViewById(R.id.privacy_chip)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -304,7 +304,7 @@ abstract class ShadeViewProviderModule {
|
||||
fun providesStatusIconContainer(
|
||||
@Named(SHADE_HEADER) header: MotionLayout,
|
||||
): StatusIconContainer {
|
||||
return header.findViewById(R.id.statusIcons)
|
||||
return header.requireViewById(R.id.statusIcons)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ class BatteryStatusChip @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
|
||||
init {
|
||||
inflate(context, R.layout.battery_status_chip, this)
|
||||
roundedContainer = findViewById(R.id.rounded_container)
|
||||
batteryMeterView = findViewById(R.id.battery_meter_view)
|
||||
roundedContainer = requireViewById(R.id.rounded_container)
|
||||
batteryMeterView = requireViewById(R.id.battery_meter_view)
|
||||
updateResources()
|
||||
}
|
||||
|
||||
|
||||
@@ -423,15 +423,14 @@ constructor(
|
||||
revealGradientCenter.y = top + (revealGradientHeight / 2f)
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas?) {
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
if (
|
||||
canvas == null ||
|
||||
revealGradientWidth <= 0 ||
|
||||
revealGradientHeight <= 0 ||
|
||||
revealAmount == 0f
|
||||
revealGradientWidth <= 0 ||
|
||||
revealGradientHeight <= 0 ||
|
||||
revealAmount == 0f
|
||||
) {
|
||||
if (revealAmount < 1f) {
|
||||
canvas?.drawColor(revealGradientEndColor)
|
||||
canvas.drawColor(revealGradientEndColor)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ class LockscreenShadeTransitionController @Inject constructor(
|
||||
}
|
||||
if (endlistener != null) {
|
||||
dragDownAnimator.addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
endlistener.invoke()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,7 +66,7 @@ class MediaArtworkProcessor @Inject constructor() {
|
||||
inBitmap = oldIn.copy(Bitmap.Config.ARGB_8888, false /* isMutable */)
|
||||
oldIn.recycle()
|
||||
}
|
||||
val outBitmap = Bitmap.createBitmap(inBitmap.width, inBitmap.height,
|
||||
val outBitmap = Bitmap.createBitmap(inBitmap?.width ?: 0, inBitmap?.height ?: 0,
|
||||
Bitmap.Config.ARGB_8888)
|
||||
|
||||
input = Allocation.createFromBitmap(renderScript, inBitmap,
|
||||
|
||||
@@ -272,7 +272,7 @@ class NotificationShadeDepthController @Inject constructor(
|
||||
blurUtils.blurRadiusOfRatio(animation.animatedValue as Float)
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
keyguardAnimator = null
|
||||
wakeAndUnlockBlurRadius = 0f
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ open class PrivacyDotViewController @Inject constructor(
|
||||
}
|
||||
|
||||
// Set the dot's view gravity to hug the status bar
|
||||
(corner.findViewById<View>(R.id.privacy_dot)
|
||||
(corner.requireViewById<View>(R.id.privacy_dot)
|
||||
.layoutParams as FrameLayout.LayoutParams)
|
||||
.gravity = rotatedCorner.innerGravity()
|
||||
}
|
||||
@@ -255,7 +255,7 @@ open class PrivacyDotViewController @Inject constructor(
|
||||
// in every rotation. The only thing we need to check is rtl
|
||||
val rtl = state.layoutRtl
|
||||
val size = Point()
|
||||
tl.context.display.getRealSize(size)
|
||||
tl.context.display?.getRealSize(size)
|
||||
val currentRotation = RotationUtils.getExactRotation(tl.context)
|
||||
|
||||
val displayWidth: Int
|
||||
|
||||
@@ -179,15 +179,20 @@ constructor(
|
||||
}
|
||||
if (weatherTarget != null) {
|
||||
val clickIntent = weatherTarget.headerAction?.intent
|
||||
val weatherData = WeatherData.fromBundle(weatherTarget.baseAction.extras, { v ->
|
||||
if (!falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
|
||||
activityStarter.startActivity(
|
||||
clickIntent,
|
||||
true, /* dismissShade */
|
||||
null,
|
||||
false)
|
||||
val weatherData = weatherTarget.baseAction?.extras?.let { extras ->
|
||||
WeatherData.fromBundle(
|
||||
extras,
|
||||
) { _ ->
|
||||
if (!falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
|
||||
activityStarter.startActivity(
|
||||
clickIntent,
|
||||
true, /* dismissShade */
|
||||
null,
|
||||
false)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (weatherData != null) {
|
||||
keyguardUpdateMonitor.sendWeatherData(weatherData)
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class ViewGroupFadeHelper {
|
||||
root.setTag(R.id.view_group_fade_helper_previous_value_tag, newAlpha)
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
endRunnable?.run()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -60,7 +60,7 @@ class ChannelEditorListView(c: Context, attrs: AttributeSet) : LinearLayout(c, a
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
|
||||
appControlRow = findViewById(R.id.app_control)
|
||||
appControlRow = requireViewById(R.id.app_control)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,9 +143,9 @@ class AppControlView(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
|
||||
lateinit var switch: Switch
|
||||
|
||||
override fun onFinishInflate() {
|
||||
iconView = findViewById(R.id.icon)
|
||||
channelName = findViewById(R.id.app_name)
|
||||
switch = findViewById(R.id.toggle)
|
||||
iconView = requireViewById(R.id.icon)
|
||||
channelName = requireViewById(R.id.app_name)
|
||||
switch = requireViewById(R.id.toggle)
|
||||
|
||||
setOnClickListener { switch.toggle() }
|
||||
}
|
||||
@@ -174,9 +174,9 @@ class ChannelRow(c: Context, attrs: AttributeSet) : LinearLayout(c, attrs) {
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
channelName = findViewById(R.id.channel_name)
|
||||
channelDescription = findViewById(R.id.channel_description)
|
||||
switch = findViewById(R.id.toggle)
|
||||
channelName = requireViewById(R.id.channel_name)
|
||||
channelDescription = requireViewById(R.id.channel_description)
|
||||
switch = requireViewById(R.id.toggle)
|
||||
switch.setOnCheckedChangeListener { _, b ->
|
||||
channel?.let {
|
||||
controller.proposeEditForChannel(it, if (b) it.importance else IMPORTANCE_NONE)
|
||||
|
||||
@@ -914,8 +914,8 @@ constructor(
|
||||
val packages: Array<String> =
|
||||
context.resources.getStringArray(R.array.system_ui_packages)
|
||||
for (pkg in packages) {
|
||||
if (intent.component == null) break
|
||||
if (pkg == intent.component.packageName) {
|
||||
val componentName = intent.component ?: break
|
||||
if (pkg == componentName.packageName) {
|
||||
return UserHandle(UserHandle.myUserId())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.plugins.FalsingManager
|
||||
import com.android.systemui.statusbar.VibratorHelper
|
||||
import com.android.systemui.util.animation.requiresRemeasuring
|
||||
|
||||
/**
|
||||
* Renders the bottom area of the lock-screen. Concerned primarily with the quick affordance UI
|
||||
@@ -98,7 +99,7 @@ constructor(
|
||||
ambientIndicationArea?.let { nonNullAmbientIndicationArea ->
|
||||
// remove old ambient indication from its parent
|
||||
val originalAmbientIndicationView =
|
||||
oldBottomArea.findViewById<View>(R.id.ambient_indication_container)
|
||||
oldBottomArea.requireViewById<View>(R.id.ambient_indication_container)
|
||||
(originalAmbientIndicationView.parent as ViewGroup).removeView(
|
||||
originalAmbientIndicationView
|
||||
)
|
||||
|
||||
@@ -75,13 +75,13 @@ class PhoneStatusBarViewController private constructor(
|
||||
}
|
||||
|
||||
override fun onViewAttached() {
|
||||
statusContainer = mView.findViewById(R.id.system_icons)
|
||||
statusContainer = mView.requireViewById(R.id.system_icons)
|
||||
statusContainer.setOnHoverListener(
|
||||
statusOverlayHoverListenerFactory.createDarkAwareListener(statusContainer))
|
||||
if (moveFromCenterAnimationController == null) return
|
||||
|
||||
val statusBarLeftSide: View = mView.findViewById(R.id.status_bar_start_side_except_heads_up)
|
||||
val systemIconArea: ViewGroup = mView.findViewById(R.id.status_bar_end_side_content)
|
||||
val statusBarLeftSide: View = mView.requireViewById(R.id.status_bar_start_side_except_heads_up)
|
||||
val systemIconArea: ViewGroup = mView.requireViewById(R.id.status_bar_end_side_content)
|
||||
|
||||
val viewsToAnimate = arrayOf(
|
||||
statusBarLeftSide,
|
||||
|
||||
@@ -117,11 +117,11 @@ class StatusBarContentInsetsProvider @Inject constructor(
|
||||
* status bar area is contiguous.
|
||||
*/
|
||||
fun currentRotationHasCornerCutout(): Boolean {
|
||||
val cutout = context.display.cutout ?: return false
|
||||
val cutout = checkNotNull(context.display).cutout ?: return false
|
||||
val topBounds = cutout.boundingRectTop
|
||||
|
||||
val point = Point()
|
||||
context.display.getRealSize(point)
|
||||
checkNotNull(context.display).getRealSize(point)
|
||||
|
||||
return topBounds.left <= 0 || topBounds.right >= point.x
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class StatusBarContentInsetsProvider @Inject constructor(
|
||||
*/
|
||||
fun getStatusBarContentInsetsForRotation(@Rotation rotation: Int): Pair<Int, Int> =
|
||||
traceSection(tag = "StatusBarContentInsetsProvider.getStatusBarContentInsetsForRotation") {
|
||||
val displayCutout = context.display.cutout
|
||||
val displayCutout = checkNotNull(context.display).cutout
|
||||
val key = getCacheKey(rotation, displayCutout)
|
||||
|
||||
val screenBounds = context.resources.configuration.windowConfiguration.maxBounds
|
||||
@@ -198,7 +198,7 @@ class StatusBarContentInsetsProvider @Inject constructor(
|
||||
fun getStatusBarContentAreaForRotation(
|
||||
@Rotation rotation: Int
|
||||
): Rect {
|
||||
val displayCutout = context.display.cutout
|
||||
val displayCutout = checkNotNull(context.display).cutout
|
||||
val key = getCacheKey(rotation, displayCutout)
|
||||
return insetsCache[key] ?: getAndSetCalculatedAreaForRotation(
|
||||
rotation, displayCutout, getResourcesForRotation(rotation, context), key)
|
||||
|
||||
@@ -105,18 +105,18 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
||||
}
|
||||
}
|
||||
addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationCancel(animation: Animator?) {
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
if (lightRevealScrim.revealEffect !is CircleReveal) {
|
||||
lightRevealScrim.revealAmount = 1f
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
lightRevealAnimationPlaying = false
|
||||
interactionJankMonitor.end(CUJ_SCREEN_OFF)
|
||||
}
|
||||
|
||||
override fun onAnimationStart(animation: Animator?) {
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
interactionJankMonitor.begin(
|
||||
notifShadeWindowControllerLazy.get().windowRootView, CUJ_SCREEN_OFF)
|
||||
}
|
||||
@@ -345,7 +345,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
||||
// portrait. If we're in another orientation, disable the screen off animation so we don't
|
||||
// animate in the keyguard AOD UI sideways or upside down.
|
||||
if (!keyguardStateController.isKeyguardScreenRotationAllowed &&
|
||||
context.display.rotation != Surface.ROTATION_0) {
|
||||
context.display?.rotation != Surface.ROTATION_0) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class StatusBarUserSwitcherContainer(
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
text = findViewById(R.id.current_user_name)
|
||||
avatar = findViewById(R.id.current_user_avatar)
|
||||
text = requireViewById(R.id.current_user_name)
|
||||
avatar = requireViewById(R.id.current_user_avatar)
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,8 @@ public class DeviceControlsControllerImpl @Inject constructor(
|
||||
|
||||
val prefs = userContextProvider.userContext.getSharedPreferences(
|
||||
PREFS_CONTROLS_FILE, Context.MODE_PRIVATE)
|
||||
val seededPackages = prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, emptySet())
|
||||
val seededPackages =
|
||||
prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, emptySet()) ?: emptySet()
|
||||
|
||||
val controlsController = controlsComponent.getControlsController().get()
|
||||
val componentsToSeed = mutableListOf<ComponentName>()
|
||||
@@ -174,7 +175,8 @@ public class DeviceControlsControllerImpl @Inject constructor(
|
||||
}
|
||||
|
||||
private fun addPackageToSeededSet(prefs: SharedPreferences, pkg: String) {
|
||||
val seededPackages = prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, emptySet())
|
||||
val seededPackages =
|
||||
prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, emptySet()) ?: emptySet()
|
||||
val updatedPkgs = seededPackages.toMutableSet()
|
||||
updatedPkgs.add(pkg)
|
||||
prefs.edit().putStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, updatedPkgs).apply()
|
||||
|
||||
@@ -353,8 +353,8 @@ constructor(
|
||||
// before CoreStartables run, and will not be removed.
|
||||
// In many cases, it reports the battery level of the stylus.
|
||||
registerBatteryListener(deviceId)
|
||||
} else if (device.bluetoothAddress != null) {
|
||||
onStylusBluetoothConnected(deviceId, device.bluetoothAddress)
|
||||
} else {
|
||||
device.bluetoothAddress?.let { onStylusBluetoothConnected(deviceId, it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class UserSwitchFullscreenDialog(
|
||||
|
||||
override fun getWidth(): Int {
|
||||
val displayMetrics = context.resources.displayMetrics.apply {
|
||||
context.display.getRealMetrics(this)
|
||||
checkNotNull(context.display).getRealMetrics(this)
|
||||
}
|
||||
return displayMetrics.widthPixels
|
||||
}
|
||||
|
||||
@@ -52,22 +52,22 @@ class UserSwitcherPopupMenu(
|
||||
override fun show() {
|
||||
// need to call show() first in order to construct the listView
|
||||
super.show()
|
||||
val listView = getListView()
|
||||
listView?.apply {
|
||||
isVerticalScrollBarEnabled = false
|
||||
isHorizontalScrollBarEnabled = false
|
||||
|
||||
listView.setVerticalScrollBarEnabled(false)
|
||||
listView.setHorizontalScrollBarEnabled(false)
|
||||
// Creates a transparent spacer between items
|
||||
val shape = ShapeDrawable()
|
||||
shape.alpha = 0
|
||||
divider = shape
|
||||
dividerHeight = res.getDimensionPixelSize(
|
||||
R.dimen.bouncer_user_switcher_popup_divider_height)
|
||||
|
||||
// Creates a transparent spacer between items
|
||||
val shape = ShapeDrawable()
|
||||
shape.setAlpha(0)
|
||||
listView.setDivider(shape)
|
||||
listView.setDividerHeight(res.getDimensionPixelSize(
|
||||
R.dimen.bouncer_user_switcher_popup_divider_height))
|
||||
|
||||
val height = res.getDimensionPixelSize(R.dimen.bouncer_user_switcher_popup_header_height)
|
||||
listView.addHeaderView(createSpacer(height), null, false)
|
||||
listView.addFooterView(createSpacer(height), null, false)
|
||||
setWidth(findMaxWidth(listView))
|
||||
val height = res.getDimensionPixelSize(R.dimen.bouncer_user_switcher_popup_header_height)
|
||||
addHeaderView(createSpacer(height), null, false)
|
||||
addFooterView(createSpacer(height), null, false)
|
||||
setWidth(findMaxWidth(this))
|
||||
}
|
||||
|
||||
super.show()
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ object LegacyUserUiHelper {
|
||||
val resourceId: Int? = getGuestUserRecordNameResourceId(record)
|
||||
return when {
|
||||
resourceId != null -> context.getString(resourceId)
|
||||
record.info != null -> record.info.name
|
||||
record.info != null -> checkNotNull(record.info.name)
|
||||
else ->
|
||||
context.getString(
|
||||
getUserSwitcherActionTextResourceId(
|
||||
|
||||
@@ -223,11 +223,11 @@ class TransitionLayout @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas?) {
|
||||
canvas?.save()
|
||||
canvas?.clipRect(boundsRect)
|
||||
override fun dispatchDraw(canvas: Canvas) {
|
||||
canvas.save()
|
||||
canvas.clipRect(boundsRect)
|
||||
super.dispatchDraw(canvas)
|
||||
canvas?.restore()
|
||||
canvas.restore()
|
||||
}
|
||||
|
||||
private fun updateBounds() {
|
||||
|
||||
@@ -164,7 +164,7 @@ class SideFpsControllerTest : SysuiTestCase() {
|
||||
context.addMockSystemService(WindowManager::class.java, windowManager)
|
||||
|
||||
whenEver(layoutInflater.inflate(R.layout.sidefps_view, null, false)).thenReturn(sideFpsView)
|
||||
whenEver(sideFpsView.findViewById<LottieAnimationView>(eq(R.id.sidefps_animation)))
|
||||
whenEver(sideFpsView.requireViewById<LottieAnimationView>(eq(R.id.sidefps_animation)))
|
||||
.thenReturn(mock(LottieAnimationView::class.java))
|
||||
with(mock(ViewPropertyAnimator::class.java)) {
|
||||
whenEver(sideFpsView.animate()).thenReturn(this)
|
||||
|
||||
@@ -138,19 +138,19 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
whenever<Clock>(view.findViewById(R.id.clock)).thenReturn(clock)
|
||||
whenever<Clock>(view.requireViewById(R.id.clock)).thenReturn(clock)
|
||||
whenever(clock.context).thenReturn(mockedContext)
|
||||
|
||||
whenever<TextView>(view.findViewById(R.id.date)).thenReturn(date)
|
||||
whenever<TextView>(view.requireViewById(R.id.date)).thenReturn(date)
|
||||
whenever(date.context).thenReturn(mockedContext)
|
||||
|
||||
whenever<ShadeCarrierGroup>(view.findViewById(R.id.carrier_group)).thenReturn(carrierGroup)
|
||||
whenever<ShadeCarrierGroup>(view.requireViewById(R.id.carrier_group)).thenReturn(carrierGroup)
|
||||
|
||||
whenever<BatteryMeterView>(view.findViewById(R.id.batteryRemainingIcon))
|
||||
whenever<BatteryMeterView>(view.requireViewById(R.id.batteryRemainingIcon))
|
||||
.thenReturn(batteryMeterView)
|
||||
|
||||
whenever<StatusIconContainer>(view.findViewById(R.id.statusIcons)).thenReturn(statusIcons)
|
||||
whenever<View>(view.findViewById(R.id.shade_header_system_icons)).thenReturn(systemIcons)
|
||||
whenever<StatusIconContainer>(view.requireViewById(R.id.statusIcons)).thenReturn(statusIcons)
|
||||
whenever<View>(view.requireViewById(R.id.shade_header_system_icons)).thenReturn(systemIcons)
|
||||
|
||||
viewContext = Mockito.spy(context)
|
||||
whenever(view.context).thenReturn(viewContext)
|
||||
|
||||
Reference in New Issue
Block a user