关于Android 11 Settings添加新的选项界面的细节
--- a/packages/apps/Settings/src/com/android/settings/Settings.java
+++ b/packages/apps/Settings/src/com/android/settings/Settings.java
@@ -243,4 +243,6 @@ public class Settings extends SettingsActivity {
public static class ScreenshotSettingsActivity extends SettingsActivity { /* empty */ }
public static class HdmiSettingsActivity extends SettingsActivity {}
+
+ public static class PersonalizeDisplaySettingsActivity extends SettingsActivity { /* empty */ }//add xxx
}
diff --git a/packages/apps/Settings/src/com/android/settings/SettingsActivity.java b/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
old mode 100644
new mode 100755
index 76739f0495..dafcb83233
--- a/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
+++ b/packages/apps/Settings/src/com/android/settings/SettingsActivity.java
@@ -59,6 +59,7 @@ import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.core.gateway.SettingsGateway;
import com.android.settings.dashboard.DashboardFeatureProvider;
+import com.android.settings.display.factory.PersonalizeDisplaySettings;
import com.android.settings.display.HdmiSettings;
import com.android.settings.ethernet.EthernetSettings;
import com.android.settings.homepage.TopLevelSettings;
@@ -669,6 +670,13 @@ public class SettingsActivity extends SettingsBaseActivity
HdmiSettings.isAvailable(), isAdmin)
|| somethingChanged;
+ //add xxx start
+ somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
+ Settings.PersonalizeDisplaySettingsActivity.class.getName()),
+ PersonalizeDisplaySettings.isAvailable(), isAdmin)
+ || somethingChanged;
+ //add xxx end
+
if (UserHandle.MU_ENABLED && !isAdmin) {
// When on restricted users, disable all extra categories (but only the settings ones).
final List<DashboardCategory> categories = mDashboardFeatureProvider.getAllCategories();
diff --git a/packages/apps/Settings/src/com/android/settings/core/gateway/SettingsGateway.java b/packages/apps/Settings/src/com/android/settings/core/gateway/SettingsGateway.java
old mode 100644
new mode 100755
index 77adbf0400..cebb9ba0b5
--- a/packages/apps/Settings/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/packages/apps/Settings/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -82,6 +82,7 @@ import com.android.settings.deviceinfo.legal.ModuleLicensesDashboard;
import com.android.settings.display.HdmiSettings;
import com.android.settings.display.NightDisplaySettings;
import com.android.settings.display.darkmode.DarkModeSettingsFragment;
+import com.android.settings.display.factory.PersonalizeDisplaySettings;
import com.android.settings.dream.DreamSettings;
import com.android.settings.enterprise.EnterprisePrivacySettings;
import com.android.settings.ethernet.EthernetSettings;
@@ -186,6 +187,7 @@ public class SettingsGateway {
VpnSettings.class.getName(),
EthernetSettings.class.getName(),
HdmiSettings.class.getName(),
+ PersonalizeDisplaySettings.class.getName(),//add xxx
DataSaverSummary.class.getName(),
DateTimeSettings.class.getName(),
LocaleListEditor.class.getName(),
--- a/packages/apps/Settings/AndroidManifest.xml
+++ b/packages/apps/Settings/AndroidManifest.xml
@@ -3496,6 +3496,23 @@
android:value="com.android.settings.sound.MediaControlsSettings" />
</activity>
+ <!--Add xxx start-->
+ <activity android:name="Settings$PersonalizeDisplaySettingsActivity"
+ android:label="tangweiwen"
+ android:taskAffinity="">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE_LAUNCH" />
+ <category android:name="com.android.settings.SHORTCUT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.display.factory.PersonalizeDisplaySettings" />
+ <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+ android:value="true" />
+ </activity>
+ <!--Add xxx end-->
+
<!-- HDMI -->
<activity android:name="Settings$HdmiSettingsActivity"
android:label="@string/hdmi_settings"
public class PersonalizeDisplaySettings extends DashboardFragment {
//里面的内容,模仿settings里面的原来的设置选项界面依葫芦画瓢
}
Settings添加1级菜单并实现跳转_settings添加一级菜单-CSDN博客
Android 13 Settings添加独立单选页面,并被其他app调用_radiobuttonpickerfragment-CSDN博客