Unsupport DebugActivity & EntryProvider in Settings.

Set SpaEnvironment (with Spp only) in SettingsApplication
Remove DebugActivity & EntryProvider from Settings.

Bug: 244122804
Test: manual - build Settings
Change-Id: I18e97c80b4f1d6094bb22cf28e7e84ea325869d7
This commit is contained in:
Zekan Qian
2022-10-12 13:57:16 +08:00
parent ee4d902410
commit 430ed29262
6 changed files with 15 additions and 55 deletions

View File

@@ -4621,13 +4621,6 @@
<activity android:name=".spa.SpaActivity" android:exported="false"/>
<activity android:name=".spa.SpaBridgeActivity" android:exported="false"/>
<activity android:name=".spa.SpaDebugActivity" android:exported="false"/>
<provider
android:name=".spa.SpaEntryProvider"
android:authorities="com.android.settings.spa.provider"
android:enabled="true"
android:exported="false">
</provider>
<activity-alias android:name="UsageStatsActivity"
android:exported="true"

View File

@@ -26,7 +26,9 @@ import androidx.window.embedding.SplitController;
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
import com.android.settings.homepage.SettingsHomepageActivity;
import com.android.settings.spa.SettingsSpaEnvironment;
import com.android.settingslib.applications.AppIconCacheManager;
import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -41,6 +43,9 @@ public class SettingsApplication extends Application {
public void onCreate() {
super.onCreate();
// Set Spa environment.
setSpaEnvironment();
if (FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
&& SplitController.getInstance().isSplitSupported()) {
if (WizardManagerHelper.isUserSetupComplete(this)) {
@@ -51,6 +56,14 @@ public class SettingsApplication extends Application {
}
}
/**
* Set the spa environment instance.
* Override this function to set different spa environment for different Settings app.
*/
protected void setSpaEnvironment() {
SpaEnvironmentFactory.INSTANCE.setInstance(new SettingsSpaEnvironment());
}
public void setHomeActivity(SettingsHomepageActivity homeActivity) {
mHomeActivity = new WeakReference<>(homeActivity);
}

View File

@@ -36,7 +36,7 @@ import com.android.settingslib.spa.framework.common.SettingsPageProviderReposito
import com.android.settingslib.spa.framework.common.SpaEnvironment
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListTemplate
object SettingsSpaEnvironment : SpaEnvironment() {
open class SettingsSpaEnvironment : SpaEnvironment() {
override val pageProviderRepository = lazy {
val togglePermissionAppListTemplate = TogglePermissionAppListTemplate(
allProviders = listOf(
@@ -65,8 +65,4 @@ object SettingsSpaEnvironment : SpaEnvironment() {
),
)
}
override val browseActivityClass = SpaActivity::class.java
override val entryProviderAuthorities = "com.android.settings.spa.provider"
}

View File

@@ -20,7 +20,7 @@ import android.content.Context
import android.content.Intent
import com.android.settingslib.spa.framework.BrowseActivity
class SpaActivity : BrowseActivity(SettingsSpaEnvironment) {
class SpaActivity : BrowseActivity() {
companion object {
@JvmStatic
fun startSpaActivity(context: Context, destination: String) {

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2022 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.settings.spa
import com.android.settingslib.spa.framework.DebugActivity
class SpaDebugActivity : DebugActivity(SettingsSpaEnvironment)

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2022 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.settings.spa
import com.android.settingslib.spa.framework.EntryProvider
class SpaEntryProvider : EntryProvider(SettingsSpaEnvironment)