Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +23 −31 Original line number Diff line number Diff line Loading @@ -17,13 +17,11 @@ package com.android.systemui.keyguard.ui.binder import android.annotation.SuppressLint import android.content.Intent import android.graphics.Rect import android.graphics.drawable.Animatable2 import android.util.Size import android.view.View import android.view.ViewGroup import android.view.ViewPropertyAnimator import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator Loading @@ -34,7 +32,6 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.animation.Interpolators import com.android.settingslib.Utils import com.android.systemui.res.R import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableLinearLayout Loading @@ -43,9 +40,12 @@ import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.common.ui.binder.TextViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.doOnEnd import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -133,7 +133,6 @@ object KeyguardBottomAreaViewBinder { val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { viewModel.startButton.collect { buttonModel -> Loading Loading @@ -378,7 +377,8 @@ object KeyguardBottomAreaViewBinder { view.isClickable = viewModel.isClickable if (viewModel.isClickable) { if (viewModel.useLongPress) { val onTouchListener = KeyguardQuickAffordanceOnTouchListener( val onTouchListener = KeyguardQuickAffordanceOnTouchListener( view, viewModel, messageDisplayer, Loading @@ -403,9 +403,7 @@ object KeyguardBottomAreaViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) Loading Loading @@ -535,13 +533,7 @@ object KeyguardBottomAreaViewBinder { view: View, ) { activityStarter.postStartActivityDismissingKeyguard( Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK view.context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } }, WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD), /* delay= */ 0, /* animationController= */ ActivityLaunchAnimator.Controller.fromView(view), /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls) Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt +5 −11 Original line number Diff line number Diff line Loading @@ -17,19 +17,20 @@ package com.android.systemui.keyguard.ui.binder import android.content.Intent import android.view.View import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.systemui.res.R import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.view.LaunchableLinearLayout import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.common.ui.binder.TextViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.flow.distinctUntilChanged Loading Loading @@ -98,13 +99,7 @@ object KeyguardSettingsViewBinder { view: View, ) { activityStarter.postStartActivityDismissingKeyguard( Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK view.context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } }, WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD), /* delay= */ 0, /* animationController= */ ActivityLaunchAnimator.Controller.fromView(view), /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls) Loading @@ -127,5 +122,4 @@ object KeyguardSettingsViewBinder { } .start() } } packages/SystemUI/src/com/android/systemui/keyguard/util/WallpaperPickerIntentUtils.kt 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.util import android.content.Context import android.content.Intent import com.android.systemui.res.R /** Provides function(s) to get intent for launching the Wallpaper Picker app. */ object WallpaperPickerIntentUtils { fun getIntent(context: Context, launchSource: String): Intent { return Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } putExtra(WALLPAPER_LAUNCH_SOURCE, launchSource) } } private const val WALLPAPER_LAUNCH_SOURCE = "com.android.wallpaper.LAUNCH_SOURCE" const val LAUNCH_SOURCE_KEYGUARD = "app_launched_keyguard" } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +23 −31 Original line number Diff line number Diff line Loading @@ -17,13 +17,11 @@ package com.android.systemui.keyguard.ui.binder import android.annotation.SuppressLint import android.content.Intent import android.graphics.Rect import android.graphics.drawable.Animatable2 import android.util.Size import android.view.View import android.view.ViewGroup import android.view.ViewPropertyAnimator import android.widget.ImageView import androidx.core.animation.CycleInterpolator import androidx.core.animation.ObjectAnimator Loading @@ -34,7 +32,6 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.animation.Interpolators import com.android.settingslib.Utils import com.android.systemui.res.R import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.Expandable import com.android.systemui.animation.view.LaunchableLinearLayout Loading @@ -43,9 +40,12 @@ import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.common.ui.binder.TextViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.doOnEnd import kotlinx.coroutines.ExperimentalCoroutinesApi Loading Loading @@ -133,7 +133,6 @@ object KeyguardBottomAreaViewBinder { val disposableHandle = view.repeatWhenAttached { repeatOnLifecycle(Lifecycle.State.STARTED) { // If updated, be sure to update [KeyguardQuickAffordanceViewBinder.kt] launch { viewModel.startButton.collect { buttonModel -> Loading Loading @@ -378,7 +377,8 @@ object KeyguardBottomAreaViewBinder { view.isClickable = viewModel.isClickable if (viewModel.isClickable) { if (viewModel.useLongPress) { val onTouchListener = KeyguardQuickAffordanceOnTouchListener( val onTouchListener = KeyguardQuickAffordanceOnTouchListener( view, viewModel, messageDisplayer, Loading @@ -403,9 +403,7 @@ object KeyguardBottomAreaViewBinder { KeyguardBottomAreaVibrations.ShakeAnimationDuration.inWholeMilliseconds shakeAnimator.interpolator = CycleInterpolator(KeyguardBottomAreaVibrations.ShakeAnimationCycles) shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.doOnEnd { view.translationX = 0f } shakeAnimator.start() vibratorHelper?.vibrate(KeyguardBottomAreaVibrations.Shake) Loading Loading @@ -535,13 +533,7 @@ object KeyguardBottomAreaViewBinder { view: View, ) { activityStarter.postStartActivityDismissingKeyguard( Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK view.context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } }, WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD), /* delay= */ 0, /* animationController= */ ActivityLaunchAnimator.Controller.fromView(view), /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls) Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt +5 −11 Original line number Diff line number Diff line Loading @@ -17,19 +17,20 @@ package com.android.systemui.keyguard.ui.binder import android.content.Intent import android.view.View import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.systemui.res.R import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.view.LaunchableLinearLayout import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.common.ui.binder.TextViewBinder import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.flow.distinctUntilChanged Loading Loading @@ -98,13 +99,7 @@ object KeyguardSettingsViewBinder { view: View, ) { activityStarter.postStartActivityDismissingKeyguard( Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK view.context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } }, WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD), /* delay= */ 0, /* animationController= */ ActivityLaunchAnimator.Controller.fromView(view), /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls) Loading @@ -127,5 +122,4 @@ object KeyguardSettingsViewBinder { } .start() } }
packages/SystemUI/src/com/android/systemui/keyguard/util/WallpaperPickerIntentUtils.kt 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.util import android.content.Context import android.content.Intent import com.android.systemui.res.R /** Provides function(s) to get intent for launching the Wallpaper Picker app. */ object WallpaperPickerIntentUtils { fun getIntent(context: Context, launchSource: String): Intent { return Intent(Intent.ACTION_SET_WALLPAPER).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK context .getString(R.string.config_wallpaperPickerPackage) .takeIf { it.isNotEmpty() } ?.let { packageName -> setPackage(packageName) } putExtra(WALLPAPER_LAUNCH_SOURCE, launchSource) } } private const val WALLPAPER_LAUNCH_SOURCE = "com.android.wallpaper.LAUNCH_SOURCE" const val LAUNCH_SOURCE_KEYGUARD = "app_launched_keyguard" }