Loading packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -692,6 +692,7 @@ </activity> <activity android:name=".controls.management.ControlsFavoritingActivity" android:label="@string/controls_favorite_default_title" android:theme="@style/Theme.ControlsManagement" android:excludeFromRecents="true" android:showForAllUsers="true" Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt +4 −3 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ class ControlsFavoritingActivity @Inject constructor( val collator = Collator.getInstance(resources.configuration.locales[0]) comparator = compareBy(collator) { it.structureName } appName = intent.getCharSequenceExtra(EXTRA_APP) structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: "" structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME) fromProviderSelector = intent.getBooleanExtra(EXTRA_FROM_PROVIDER_SELECTOR, false) Loading Loading @@ -206,7 +206,9 @@ class ControlsFavoritingActivity @Inject constructor( override fun onPageSelected(position: Int) { super.onPageSelected(position) val name = listOfStructures[position].structureName titleView.text = if (!TextUtils.isEmpty(name)) name else appName val title = if (!TextUtils.isEmpty(name)) name else appName titleView.text = title setTitle(title) } override fun onPageScrolled( Loading Loading @@ -261,7 +263,6 @@ class ControlsFavoritingActivity @Inject constructor( val title = structureExtra ?: (appName ?: resources.getText(R.string.controls_favorite_default_title)) setTitle(title) titleView = requireViewById<TextView>(R.id.title).apply { text = title } Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +23 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.systemui.controls.ui import android.app.Dialog import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.os.Vibrator import android.os.VibrationEffect import android.service.controls.Control Loading @@ -26,10 +28,12 @@ import android.service.controls.actions.BooleanAction import android.service.controls.actions.CommandAction import android.util.Log import android.view.HapticFeedbackConstants import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.R import javax.inject.Inject import javax.inject.Singleton Loading @@ -38,6 +42,7 @@ import javax.inject.Singleton class ControlActionCoordinatorImpl @Inject constructor( private val context: Context, private val bgExecutor: DelayableExecutor, @Main private val uiExecutor: DelayableExecutor, private val activityStarter: ActivityStarter, private val keyguardStateController: KeyguardStateController, private val globalActionsComponent: GlobalActionsComponent Loading Loading @@ -110,9 +115,24 @@ class ControlActionCoordinatorImpl @Inject constructor( } private fun showDialog(cvh: ControlViewHolder, intent: Intent) { bgExecutor.execute { val activities: List<ResolveInfo> = cvh.context.packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ) uiExecutor.execute { // make sure the intent is valid before attempting to open the dialog if (activities.isNotEmpty()) { dialog = DetailDialog(cvh, intent).also { it.setOnDismissListener { _ -> dialog = null } it.show() } } else { cvh.setTransientStatus( cvh.context.resources.getString(R.string.controls_error_failed)) } } } } } packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt +8 −6 Original line number Diff line number Diff line Loading @@ -145,6 +145,10 @@ class ToggleRangeBehavior : Behavior { template.isChecked()) true } AccessibilityNodeInfo.ACTION_LONG_CLICK -> { cvh.controlActionCoordinator.longPress(cvh) true } AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_PROGRESS.getId() -> { if (arguments == null || !arguments.containsKey( AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE)) { Loading @@ -152,8 +156,8 @@ class ToggleRangeBehavior : Behavior { } else { val value = arguments.getFloat( AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE) val level = rangeToLevelValue(value - rangeTemplate.getCurrentValue()) updateRange(level, template.isChecked(), /* isDragging */ false) val level = rangeToLevelValue(value) updateRange(level, template.isChecked(), /* isDragging */ true) endUpdateRange() true } Loading @@ -168,7 +172,7 @@ class ToggleRangeBehavior : Behavior { host: ViewGroup, child: View, event: AccessibilityEvent ): Boolean = false ): Boolean = true }) } Loading @@ -180,14 +184,12 @@ class ToggleRangeBehavior : Behavior { fun updateRange(level: Int, checked: Boolean, isDragging: Boolean) { val newLevel = if (checked) Math.max(MIN_LEVEL, Math.min(MAX_LEVEL, level)) else MIN_LEVEL if (newLevel == clipLayer.level) return rangeAnimator?.cancel() if (isDragging) { clipLayer.level = newLevel val isEdge = newLevel == MIN_LEVEL || newLevel == MAX_LEVEL cvh.controlActionCoordinator.drag(isEdge) } else { } else if (newLevel != clipLayer.level) { rangeAnimator = ValueAnimator.ofInt(cvh.clipLayer.level, newLevel).apply { addUpdateListener { cvh.clipLayer.level = it.animatedValue as Int Loading Loading
packages/SystemUI/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -692,6 +692,7 @@ </activity> <activity android:name=".controls.management.ControlsFavoritingActivity" android:label="@string/controls_favorite_default_title" android:theme="@style/Theme.ControlsManagement" android:excludeFromRecents="true" android:showForAllUsers="true" Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt +4 −3 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ class ControlsFavoritingActivity @Inject constructor( val collator = Collator.getInstance(resources.configuration.locales[0]) comparator = compareBy(collator) { it.structureName } appName = intent.getCharSequenceExtra(EXTRA_APP) structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: "" structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME) fromProviderSelector = intent.getBooleanExtra(EXTRA_FROM_PROVIDER_SELECTOR, false) Loading Loading @@ -206,7 +206,9 @@ class ControlsFavoritingActivity @Inject constructor( override fun onPageSelected(position: Int) { super.onPageSelected(position) val name = listOfStructures[position].structureName titleView.text = if (!TextUtils.isEmpty(name)) name else appName val title = if (!TextUtils.isEmpty(name)) name else appName titleView.text = title setTitle(title) } override fun onPageScrolled( Loading Loading @@ -261,7 +263,6 @@ class ControlsFavoritingActivity @Inject constructor( val title = structureExtra ?: (appName ?: resources.getText(R.string.controls_favorite_default_title)) setTitle(title) titleView = requireViewById<TextView>(R.id.title).apply { text = title } Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +23 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.systemui.controls.ui import android.app.Dialog import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.content.pm.ResolveInfo import android.os.Vibrator import android.os.VibrationEffect import android.service.controls.Control Loading @@ -26,10 +28,12 @@ import android.service.controls.actions.BooleanAction import android.service.controls.actions.CommandAction import android.util.Log import android.view.HapticFeedbackConstants import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.R import javax.inject.Inject import javax.inject.Singleton Loading @@ -38,6 +42,7 @@ import javax.inject.Singleton class ControlActionCoordinatorImpl @Inject constructor( private val context: Context, private val bgExecutor: DelayableExecutor, @Main private val uiExecutor: DelayableExecutor, private val activityStarter: ActivityStarter, private val keyguardStateController: KeyguardStateController, private val globalActionsComponent: GlobalActionsComponent Loading Loading @@ -110,9 +115,24 @@ class ControlActionCoordinatorImpl @Inject constructor( } private fun showDialog(cvh: ControlViewHolder, intent: Intent) { bgExecutor.execute { val activities: List<ResolveInfo> = cvh.context.packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ) uiExecutor.execute { // make sure the intent is valid before attempting to open the dialog if (activities.isNotEmpty()) { dialog = DetailDialog(cvh, intent).also { it.setOnDismissListener { _ -> dialog = null } it.show() } } else { cvh.setTransientStatus( cvh.context.resources.getString(R.string.controls_error_failed)) } } } } }
packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt +8 −6 Original line number Diff line number Diff line Loading @@ -145,6 +145,10 @@ class ToggleRangeBehavior : Behavior { template.isChecked()) true } AccessibilityNodeInfo.ACTION_LONG_CLICK -> { cvh.controlActionCoordinator.longPress(cvh) true } AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_PROGRESS.getId() -> { if (arguments == null || !arguments.containsKey( AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE)) { Loading @@ -152,8 +156,8 @@ class ToggleRangeBehavior : Behavior { } else { val value = arguments.getFloat( AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE) val level = rangeToLevelValue(value - rangeTemplate.getCurrentValue()) updateRange(level, template.isChecked(), /* isDragging */ false) val level = rangeToLevelValue(value) updateRange(level, template.isChecked(), /* isDragging */ true) endUpdateRange() true } Loading @@ -168,7 +172,7 @@ class ToggleRangeBehavior : Behavior { host: ViewGroup, child: View, event: AccessibilityEvent ): Boolean = false ): Boolean = true }) } Loading @@ -180,14 +184,12 @@ class ToggleRangeBehavior : Behavior { fun updateRange(level: Int, checked: Boolean, isDragging: Boolean) { val newLevel = if (checked) Math.max(MIN_LEVEL, Math.min(MAX_LEVEL, level)) else MIN_LEVEL if (newLevel == clipLayer.level) return rangeAnimator?.cancel() if (isDragging) { clipLayer.level = newLevel val isEdge = newLevel == MIN_LEVEL || newLevel == MAX_LEVEL cvh.controlActionCoordinator.drag(isEdge) } else { } else if (newLevel != clipLayer.level) { rangeAnimator = ValueAnimator.ofInt(cvh.clipLayer.level, newLevel).apply { addUpdateListener { cvh.clipLayer.level = it.animatedValue as Int Loading