Loading packages/SystemUI/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ android_library { "androidx.dynamicanimation_dynamicanimation", "androidx-constraintlayout_constraintlayout", "androidx.exifinterface_exifinterface", "androidx.test.ext.junit", "com.google.android.material_material", "kotlin-reflect", "kotlinx_coroutines_android", Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt +24 −2 Original line number Diff line number Diff line Loading @@ -20,11 +20,14 @@ import android.app.ActivityOptions import android.content.ComponentName import android.content.Intent import android.os.Bundle import android.util.Log import android.view.View import android.view.ViewGroup import android.view.ViewStub import android.widget.Button import android.widget.TextView import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.ItemTouchHelper Loading @@ -42,7 +45,7 @@ import javax.inject.Inject /** * Activity for rearranging and removing controls for a given structure */ class ControlsEditingActivity @Inject constructor( open class ControlsEditingActivity @Inject constructor( private val controller: ControlsControllerImpl, private val broadcastDispatcher: BroadcastDispatcher, private val customIconCache: CustomIconCache, Loading @@ -50,8 +53,9 @@ class ControlsEditingActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsEditingActivity" private const val EXTRA_STRUCTURE = ControlsFavoritingActivity.EXTRA_STRUCTURE const val EXTRA_STRUCTURE = ControlsFavoritingActivity.EXTRA_STRUCTURE private val SUBTITLE_ID = R.string.controls_favorite_rearrange private val EMPTY_TEXT_ID = R.string.controls_favorite_removed } Loading @@ -73,6 +77,13 @@ class ControlsEditingActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading @@ -94,11 +105,22 @@ class ControlsEditingActivity @Inject constructor( setUpList() currentUserTracker.startTracking() if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onStop() { super.onStop() currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback(mOnBackInvokedCallback) } override fun onBackPressed() { Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt +27 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Intent import android.content.res.Configuration import android.os.Bundle import android.text.TextUtils import android.util.Log import android.view.Gravity import android.view.View import android.view.ViewGroup Loading @@ -32,6 +33,8 @@ import android.widget.Button import android.widget.FrameLayout import android.widget.TextView import android.widget.Toast import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.viewpager2.widget.ViewPager2 import com.android.systemui.Prefs Loading @@ -50,7 +53,7 @@ import java.util.concurrent.Executor import java.util.function.Consumer import javax.inject.Inject class ControlsFavoritingActivity @Inject constructor( open class ControlsFavoritingActivity @Inject constructor( @Main private val executor: Executor, private val controller: ControlsControllerImpl, private val listingController: ControlsListingController, Loading @@ -59,6 +62,7 @@ class ControlsFavoritingActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsFavoritingActivity" // If provided and no structure is available, use as the title Loading @@ -67,7 +71,7 @@ class ControlsFavoritingActivity @Inject constructor( // If provided, show this structure page first const val EXTRA_STRUCTURE = "extra_structure" const val EXTRA_SINGLE_STRUCTURE = "extra_single_structure" internal const val EXTRA_FROM_PROVIDER_SELECTOR = "extra_from_provider_selector" const val EXTRA_FROM_PROVIDER_SELECTOR = "extra_from_provider_selector" private const val TOOLTIP_PREFS_KEY = Prefs.Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT private const val TOOLTIP_MAX_SHOWN = 2 } Loading Loading @@ -102,6 +106,13 @@ class ControlsFavoritingActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } private val listingCallback = object : ControlsListingController.ControlsListingCallback { override fun onServicesUpdated(serviceInfos: List<ControlsServiceInfo>) { Loading Loading @@ -353,6 +364,12 @@ class ControlsFavoritingActivity @Inject constructor( listingController.addCallback(listingCallback) currentUserTracker.startTracking() if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onResume() { Loading @@ -372,6 +389,12 @@ class ControlsFavoritingActivity @Inject constructor( listingController.removeCallback(listingCallback) currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback( mOnBackInvokedCallback) } override fun onConfigurationChanged(newConfig: Configuration) { Loading packages/SystemUI/src/com/android/systemui/controls/management/ControlsProviderSelectorActivity.kt +23 −2 Original line number Diff line number Diff line Loading @@ -20,16 +20,18 @@ import android.app.ActivityOptions import android.content.ComponentName import android.content.Intent import android.os.Bundle import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.ViewStub import android.widget.Button import android.widget.TextView import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver import com.android.systemui.R import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.controls.controller.ControlsController Loading @@ -44,7 +46,7 @@ import javax.inject.Inject /** * Activity to select an application to favorite the [Control] provided by them. */ class ControlsProviderSelectorActivity @Inject constructor( open class ControlsProviderSelectorActivity @Inject constructor( @Main private val executor: Executor, @Background private val backExecutor: Executor, private val listingController: ControlsListingController, Loading @@ -54,6 +56,7 @@ class ControlsProviderSelectorActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsProviderSelectorActivity" const val BACK_SHOULD_EXIT = "back_should_exit" } Loading @@ -70,6 +73,13 @@ class ControlsProviderSelectorActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading Loading @@ -141,11 +151,22 @@ class ControlsProviderSelectorActivity @Inject constructor( } }) } if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onStop() { super.onStop() currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback(mOnBackInvokedCallback) } /** Loading packages/SystemUI/tests/AndroidManifest.xml +15 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,21 @@ android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsEditingActivityTest$TestableControlsEditingActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsFavoritingActivityTest$TestableControlsFavoritingActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsProviderSelectorActivityTest$TestableControlsProviderSelectorActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.screenshot.ScrollViewActivity" android:exported="false" /> Loading Loading
packages/SystemUI/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ android_library { "androidx.dynamicanimation_dynamicanimation", "androidx-constraintlayout_constraintlayout", "androidx.exifinterface_exifinterface", "androidx.test.ext.junit", "com.google.android.material_material", "kotlin-reflect", "kotlinx_coroutines_android", Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsEditingActivity.kt +24 −2 Original line number Diff line number Diff line Loading @@ -20,11 +20,14 @@ import android.app.ActivityOptions import android.content.ComponentName import android.content.Intent import android.os.Bundle import android.util.Log import android.view.View import android.view.ViewGroup import android.view.ViewStub import android.widget.Button import android.widget.TextView import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.ItemTouchHelper Loading @@ -42,7 +45,7 @@ import javax.inject.Inject /** * Activity for rearranging and removing controls for a given structure */ class ControlsEditingActivity @Inject constructor( open class ControlsEditingActivity @Inject constructor( private val controller: ControlsControllerImpl, private val broadcastDispatcher: BroadcastDispatcher, private val customIconCache: CustomIconCache, Loading @@ -50,8 +53,9 @@ class ControlsEditingActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsEditingActivity" private const val EXTRA_STRUCTURE = ControlsFavoritingActivity.EXTRA_STRUCTURE const val EXTRA_STRUCTURE = ControlsFavoritingActivity.EXTRA_STRUCTURE private val SUBTITLE_ID = R.string.controls_favorite_rearrange private val EMPTY_TEXT_ID = R.string.controls_favorite_removed } Loading @@ -73,6 +77,13 @@ class ControlsEditingActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading @@ -94,11 +105,22 @@ class ControlsEditingActivity @Inject constructor( setUpList() currentUserTracker.startTracking() if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onStop() { super.onStop() currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback(mOnBackInvokedCallback) } override fun onBackPressed() { Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt +27 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.content.Intent import android.content.res.Configuration import android.os.Bundle import android.text.TextUtils import android.util.Log import android.view.Gravity import android.view.View import android.view.ViewGroup Loading @@ -32,6 +33,8 @@ import android.widget.Button import android.widget.FrameLayout import android.widget.TextView import android.widget.Toast import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.viewpager2.widget.ViewPager2 import com.android.systemui.Prefs Loading @@ -50,7 +53,7 @@ import java.util.concurrent.Executor import java.util.function.Consumer import javax.inject.Inject class ControlsFavoritingActivity @Inject constructor( open class ControlsFavoritingActivity @Inject constructor( @Main private val executor: Executor, private val controller: ControlsControllerImpl, private val listingController: ControlsListingController, Loading @@ -59,6 +62,7 @@ class ControlsFavoritingActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsFavoritingActivity" // If provided and no structure is available, use as the title Loading @@ -67,7 +71,7 @@ class ControlsFavoritingActivity @Inject constructor( // If provided, show this structure page first const val EXTRA_STRUCTURE = "extra_structure" const val EXTRA_SINGLE_STRUCTURE = "extra_single_structure" internal const val EXTRA_FROM_PROVIDER_SELECTOR = "extra_from_provider_selector" const val EXTRA_FROM_PROVIDER_SELECTOR = "extra_from_provider_selector" private const val TOOLTIP_PREFS_KEY = Prefs.Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT private const val TOOLTIP_MAX_SHOWN = 2 } Loading Loading @@ -102,6 +106,13 @@ class ControlsFavoritingActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } private val listingCallback = object : ControlsListingController.ControlsListingCallback { override fun onServicesUpdated(serviceInfos: List<ControlsServiceInfo>) { Loading Loading @@ -353,6 +364,12 @@ class ControlsFavoritingActivity @Inject constructor( listingController.addCallback(listingCallback) currentUserTracker.startTracking() if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onResume() { Loading @@ -372,6 +389,12 @@ class ControlsFavoritingActivity @Inject constructor( listingController.removeCallback(listingCallback) currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback( mOnBackInvokedCallback) } override fun onConfigurationChanged(newConfig: Configuration) { Loading
packages/SystemUI/src/com/android/systemui/controls/management/ControlsProviderSelectorActivity.kt +23 −2 Original line number Diff line number Diff line Loading @@ -20,16 +20,18 @@ import android.app.ActivityOptions import android.content.ComponentName import android.content.Intent import android.os.Bundle import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.ViewStub import android.widget.Button import android.widget.TextView import android.window.OnBackInvokedCallback import android.window.OnBackInvokedDispatcher import androidx.activity.ComponentActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver import com.android.systemui.R import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.controls.controller.ControlsController Loading @@ -44,7 +46,7 @@ import javax.inject.Inject /** * Activity to select an application to favorite the [Control] provided by them. */ class ControlsProviderSelectorActivity @Inject constructor( open class ControlsProviderSelectorActivity @Inject constructor( @Main private val executor: Executor, @Background private val backExecutor: Executor, private val listingController: ControlsListingController, Loading @@ -54,6 +56,7 @@ class ControlsProviderSelectorActivity @Inject constructor( ) : ComponentActivity() { companion object { private const val DEBUG = false private const val TAG = "ControlsProviderSelectorActivity" const val BACK_SHOULD_EXIT = "back_should_exit" } Loading @@ -70,6 +73,13 @@ class ControlsProviderSelectorActivity @Inject constructor( } } private val mOnBackInvokedCallback = OnBackInvokedCallback { if (DEBUG) { Log.d(TAG, "Predictive Back dispatcher called mOnBackInvokedCallback") } onBackPressed() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Loading Loading @@ -141,11 +151,22 @@ class ControlsProviderSelectorActivity @Inject constructor( } }) } if (DEBUG) { Log.d(TAG, "Registered onBackInvokedCallback") } onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT, mOnBackInvokedCallback) } override fun onStop() { super.onStop() currentUserTracker.stopTracking() if (DEBUG) { Log.d(TAG, "Unregistered onBackInvokedCallback") } onBackInvokedDispatcher.unregisterOnBackInvokedCallback(mOnBackInvokedCallback) } /** Loading
packages/SystemUI/tests/AndroidManifest.xml +15 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,21 @@ android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsEditingActivityTest$TestableControlsEditingActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsFavoritingActivityTest$TestableControlsFavoritingActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.controls.management.ControlsProviderSelectorActivityTest$TestableControlsProviderSelectorActivity" android:exported="false" android:excludeFromRecents="true" /> <activity android:name="com.android.systemui.screenshot.ScrollViewActivity" android:exported="false" /> Loading