Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6b55865 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Controls in QS" into sc-dev

parents 7d0075c9 ffb1601d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -757,6 +757,7 @@
                  android:excludeFromRecents="true"
                  android:showWhenLocked="true"
                  android:showForAllUsers="true"
                  android:finishOnTaskLaunch="true"
                  android:launchMode="singleInstance"
                  android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
                  android:visibleToInstantApps="true">
+0 −6
Original line number Diff line number Diff line
@@ -30,12 +30,6 @@
          android:layout_width="match_parent"
          android:layout_height="wrap_content"/>

      <LinearLayout
          android:id="@+id/global_actions_controls"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"/>

    </LinearLayout>
  </com.android.systemui.globalactions.MinHeightScrollView>
</LinearLayout>
+5 −4
Original line number Diff line number Diff line
@@ -44,8 +44,9 @@ import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dump.DumpManager
import com.android.systemui.globalactions.GlobalActionsDialog
import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.policy.DeviceControlsControllerImpl.Companion.PREFS_CONTROLS_FILE
import com.android.systemui.statusbar.policy.DeviceControlsControllerImpl.Companion.PREFS_CONTROLS_SEEDING_COMPLETED
import com.android.systemui.util.concurrency.DelayableExecutor
import java.io.FileDescriptor
import java.io.PrintWriter
@@ -198,11 +199,11 @@ class ControlsControllerImpl @Inject constructor (
                // When a component is uninstalled, allow seeding to happen again if the user
                // reinstalls the app
                val prefs = userStructure.userContext.getSharedPreferences(
                    GlobalActionsDialog.PREFS_CONTROLS_FILE, Context.MODE_PRIVATE)
                    PREFS_CONTROLS_FILE, Context.MODE_PRIVATE)
                val completedSeedingPackageSet = prefs.getStringSet(
                    GlobalActionsDialog.PREFS_CONTROLS_SEEDING_COMPLETED, mutableSetOf<String>())
                    PREFS_CONTROLS_SEEDING_COMPLETED, mutableSetOf<String>())
                val servicePackageSet = serviceInfoSet.map { it.packageName }
                prefs.edit().putStringSet(GlobalActionsDialog.PREFS_CONTROLS_SEEDING_COMPLETED,
                prefs.edit().putStringSet(PREFS_CONTROLS_SEEDING_COMPLETED,
                    completedSeedingPackageSet.intersect(servicePackageSet)).apply()

                var changed = false
+6 −18
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.controls.management

import android.app.ActivityOptions
import android.content.ComponentName
import android.content.Intent
import android.os.Bundle
@@ -34,7 +35,6 @@ import com.android.systemui.controls.controller.ControlsControllerImpl
import com.android.systemui.controls.controller.StructureInfo
import com.android.systemui.controls.ui.ControlsActivity
import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.globalactions.GlobalActionsComponent
import com.android.systemui.settings.CurrentUserTracker
import com.android.systemui.util.LifecycleActivity
import javax.inject.Inject
@@ -45,7 +45,6 @@ import javax.inject.Inject
class ControlsEditingActivity @Inject constructor(
    private val controller: ControlsControllerImpl,
    private val broadcastDispatcher: BroadcastDispatcher,
    private val globalActionsComponent: GlobalActionsComponent,
    private val customIconCache: CustomIconCache,
    private val uiController: ControlsUiController
) : LifecycleActivity() {
@@ -62,7 +61,6 @@ class ControlsEditingActivity @Inject constructor(
    private lateinit var model: FavoritesModel
    private lateinit var subtitle: TextView
    private lateinit var saveButton: View
    private var backToGlobalActions = true

    private val currentUserTracker = object : CurrentUserTracker(broadcastDispatcher) {
        private val startingUser = controller.currentUserId
@@ -86,11 +84,6 @@ class ControlsEditingActivity @Inject constructor(
            structure = it
        } ?: run(this::finish)

        backToGlobalActions = intent.getBooleanExtra(
            ControlsUiController.BACK_TO_GLOBAL_ACTIONS,
            true
        )

        bindViews()

        bindButtons()
@@ -109,15 +102,6 @@ class ControlsEditingActivity @Inject constructor(
    }

    override fun onBackPressed() {
        if (backToGlobalActions) {
            globalActionsComponent.handleShowGlobalActionsMenu()
        } else {
            val i = Intent().apply {
                component = ComponentName(applicationContext, ControlsActivity::class.java)
                addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
            }
            startActivity(i)
        }
        animateExitAndFinish()
    }

@@ -161,8 +145,12 @@ class ControlsEditingActivity @Inject constructor(
            setText(R.string.save)
            setOnClickListener {
                saveFavorites()
                startActivity(
                    Intent(applicationContext, ControlsActivity::class.java),
                    ActivityOptions
                        .makeSceneTransitionAnimation(this@ControlsEditingActivity).toBundle()
                )
                animateExitAndFinish()
                globalActionsComponent.handleShowGlobalActionsMenu()
            }
        }
    }
+9 −26
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import com.android.systemui.controls.controller.StructureInfo
import com.android.systemui.controls.ui.ControlsActivity
import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.globalactions.GlobalActionsComponent
import com.android.systemui.settings.CurrentUserTracker
import com.android.systemui.util.LifecycleActivity
import java.text.Collator
@@ -56,7 +55,6 @@ class ControlsFavoritingActivity @Inject constructor(
    private val controller: ControlsControllerImpl,
    private val listingController: ControlsListingController,
    private val broadcastDispatcher: BroadcastDispatcher,
    private val globalActionsComponent: GlobalActionsComponent,
    private val uiController: ControlsUiController
) : LifecycleActivity() {

@@ -92,7 +90,6 @@ class ControlsFavoritingActivity @Inject constructor(
    private lateinit var comparator: Comparator<StructureContainer>
    private var cancelLoadRunnable: Runnable? = null
    private var isPagerLoaded = false
    private var backToGlobalActions = true

    private val currentUserTracker = object : CurrentUserTracker(broadcastDispatcher) {
        private val startingUser = controller.currentUserId
@@ -133,11 +130,6 @@ class ControlsFavoritingActivity @Inject constructor(
        component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME)
        fromProviderSelector = intent.getBooleanExtra(EXTRA_FROM_PROVIDER_SELECTOR, false)

        backToGlobalActions = intent.getBooleanExtra(
            ControlsUiController.BACK_TO_GLOBAL_ACTIONS,
            true
        )

        bindViews()
    }

@@ -311,13 +303,6 @@ class ControlsFavoritingActivity @Inject constructor(
    private fun bindButtons() {
        otherAppsButton = requireViewById<Button>(R.id.other_apps).apply {
            setOnClickListener {
                val i = Intent().apply {
                    component = ComponentName(context, ControlsProviderSelectorActivity::class.java)
                    putExtra(
                        ControlsUiController.BACK_TO_GLOBAL_ACTIONS,
                        backToGlobalActions
                    )
                }
                if (doneButton.isEnabled) {
                    // The user has made changes
                    Toast.makeText(
@@ -326,8 +311,11 @@ class ControlsFavoritingActivity @Inject constructor(
                            Toast.LENGTH_SHORT
                            ).show()
                }
                startActivity(i, ActivityOptions
                    .makeSceneTransitionAnimation(this@ControlsFavoritingActivity).toBundle())
                startActivity(
                    Intent(context, ControlsProviderSelectorActivity::class.java),
                    ActivityOptions
                        .makeSceneTransitionAnimation(this@ControlsFavoritingActivity).toBundle()
                )
                animateExitAndFinish()
            }
        }
@@ -349,15 +337,10 @@ class ControlsFavoritingActivity @Inject constructor(
    }

    private fun openControlsOrigin() {
        if (backToGlobalActions) {
            globalActionsComponent.handleShowGlobalActionsMenu()
        } else {
            val i = Intent().apply {
                component = ComponentName(applicationContext, ControlsActivity::class.java)
                addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
            }
            startActivity(i)
        }
        startActivity(
            Intent(applicationContext, ControlsActivity::class.java),
            ActivityOptions.makeSceneTransitionAnimation(this).toBundle()
        )
    }

    override fun onPause() {
Loading