summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Darrell Shi <darrellshi@google.com> 2024-01-04 18:49:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-01-04 18:49:29 +0000
commit83f048490f7a3df91b5caba2417eaac90d8b5bbe (patch)
tree7f204d29f4e54cd11a303dc21cfa51e7a9cf7b0a
parent38113e6b3dbd4880e1b44f52c909996b3994cf84 (diff)
parentd618866d5724e8d1fa995e80046d06386a669003 (diff)
Merge "Dismiss keyguard before starting edit activity" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt16
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarter.kt17
2 files changed, 19 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
index 847b98e82d80..10768ea6122a 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/dagger/CommunalModule.kt
@@ -16,7 +16,6 @@
package com.android.systemui.communal.dagger
-import android.content.Context
import com.android.systemui.communal.data.db.CommunalDatabaseModule
import com.android.systemui.communal.data.repository.CommunalMediaRepositoryModule
import com.android.systemui.communal.data.repository.CommunalRepositoryModule
@@ -24,9 +23,8 @@ import com.android.systemui.communal.data.repository.CommunalTutorialRepositoryM
import com.android.systemui.communal.data.repository.CommunalWidgetRepositoryModule
import com.android.systemui.communal.widgets.EditWidgetsActivityStarter
import com.android.systemui.communal.widgets.EditWidgetsActivityStarterImpl
-import com.android.systemui.dagger.qualifiers.Application
+import dagger.Binds
import dagger.Module
-import dagger.Provides
@Module(
includes =
@@ -38,11 +36,9 @@ import dagger.Provides
CommunalDatabaseModule::class,
]
)
-class CommunalModule {
- @Provides
- fun provideEditWidgetsActivityStarter(
- @Application context: Context
- ): EditWidgetsActivityStarter {
- return EditWidgetsActivityStarterImpl(context)
- }
+interface CommunalModule {
+ @Binds
+ fun bindEditWidgetsActivityStarter(
+ starter: EditWidgetsActivityStarterImpl
+ ): EditWidgetsActivityStarter
}
diff --git a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarter.kt b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarter.kt
index 846e3000284f..55acad0e9ed5 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarter.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/EditWidgetsActivityStarter.kt
@@ -19,17 +19,26 @@ package com.android.systemui.communal.widgets
import android.content.Context
import android.content.Intent
import com.android.systemui.dagger.qualifiers.Application
+import com.android.systemui.plugins.ActivityStarter
+import javax.inject.Inject
interface EditWidgetsActivityStarter {
fun startActivity()
}
-class EditWidgetsActivityStarterImpl(@Application private val applicationContext: Context) :
- EditWidgetsActivityStarter {
+class EditWidgetsActivityStarterImpl
+@Inject
+constructor(
+ @Application private val applicationContext: Context,
+ private val activityStarter: ActivityStarter,
+) : EditWidgetsActivityStarter {
+
override fun startActivity() {
- applicationContext.startActivity(
+ activityStarter.startActivityDismissingKeyguard(
Intent(applicationContext, EditWidgetsActivity::class.java)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK),
+ /* onlyProvisioned = */ true,
+ /* dismissShade = */ true,
)
}
}