packages/apps/Settings
Revision | a6c73a8124adc2d4fdfe6bdbcc8de96a5ae34293 (tree) |
---|---|
Time | 2021-11-05 10:36:41 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Mauro Rossi |
Add Android-x86 dashboard
Add an option to enable or disable native bridge.
More options will be added in the future.
@@ -3010,6 +3010,26 @@ | ||
3010 | 3010 | android:value="com.android.settings.applications.AppAndNotificationDashboardFragment"/> |
3011 | 3011 | </activity> |
3012 | 3012 | |
3013 | + <activity android:name=".Settings$AndroidX86DashboardActivity" | |
3014 | + android:label="@string/android_x86_options_title" | |
3015 | + android:icon="@drawable/ic_settings_applications"> | |
3016 | + <intent-filter> | |
3017 | + <action android:name="android.intent.action.MAIN" /> | |
3018 | + <category android:name="android.intent.category.DEFAULT" /> | |
3019 | + </intent-filter> | |
3020 | + <intent-filter android:priority="6"> | |
3021 | + <action android:name="com.android.settings.action.SETTINGS" /> | |
3022 | + </intent-filter> | |
3023 | + <meta-data android:name="com.android.settings.FRAGMENT_CLASS" | |
3024 | + android:value="com.android.settings.system.AndroidX86DashboardFragment" /> | |
3025 | + <meta-data android:name="com.android.settings.category" | |
3026 | + android:value="com.android.settings.category.ia.homepage" /> | |
3027 | + <meta-data android:name="com.android.settings.summary" | |
3028 | + android:resource="@string/android_x86_dashboard_summary"/> | |
3029 | + <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" | |
3030 | + android:value="true" /> | |
3031 | + </activity> | |
3032 | + | |
3013 | 3033 | <activity |
3014 | 3034 | android:name=".Settings$AccountDashboardActivity" |
3015 | 3035 | android:label="@string/account_dashboard_title" |
@@ -2011,6 +2011,10 @@ | ||
2011 | 2011 | <string name="runningservicedetails_stop_dlg_title" msgid="6201041461740445113">"要停止系统服务吗?"</string> |
2012 | 2012 | <string name="runningservicedetails_stop_dlg_text" product="tablet" msgid="2076922609580490122">"如果停止此服务,您平板电脑上的某些功能也将随之停止工作,并在您将平板电脑关机然后再重新打开后才能使用。"</string> |
2013 | 2013 | <string name="runningservicedetails_stop_dlg_text" product="default" msgid="2625863973434309085">"如果停止此服务,您手机上的某些功能也将随之停止工作,并在您将手机关机然后再重新打开后才能使用。"</string> |
2014 | + <string name="android_x86_options_title">"安卓X86设置"</string> | |
2015 | + <string name="android_x86_dashboard_summary">兼容模式、统计</string> | |
2016 | + <string name="nativebridge_toggle_title">"兼容模式"</string> | |
2017 | + <string name="nativebridge_toggle_summary">"可兼容於使用 arm 庫的应用"</string> | |
2014 | 2018 | <string name="language_input_gesture_title" msgid="3292455685728572960">"语言、输入法和手势"</string> |
2015 | 2019 | <string name="language_input_gesture_summary_on_with_assist" msgid="8670153838520237089"></string> |
2016 | 2020 | <string name="language_input_gesture_summary_on_non_assist" msgid="2738661322747920463"></string> |
@@ -2011,6 +2011,10 @@ | ||
2011 | 2011 | <string name="runningservicedetails_stop_dlg_title" msgid="6201041461740445113">"停止系統服務?"</string> |
2012 | 2012 | <string name="runningservicedetails_stop_dlg_text" product="tablet" msgid="2076922609580490122">"如果您停用這項服務,您平板電腦上的某些功能可能會停止正常運作,待您重新開機後才會恢復正常。"</string> |
2013 | 2013 | <string name="runningservicedetails_stop_dlg_text" product="default" msgid="2625863973434309085">"如果您停用這項服務,您手機上的某些功能可能會停止正常運作,待您重新開機後才會恢復正常。"</string> |
2014 | + <string name="android_x86_options_title">"Android-x86 設定"</string> | |
2015 | + <string name="android_x86_dashboard_summary">原生相容模式、統計</string> | |
2016 | + <string name="nativebridge_toggle_title">"原生相容模式"</string> | |
2017 | + <string name="nativebridge_toggle_summary">"可相容於使用 arm 原生函式庫的應用程式"</string> | |
2014 | 2018 | <string name="language_input_gesture_title" msgid="3292455685728572960">"語言、輸入和手勢"</string> |
2015 | 2019 | <string name="language_input_gesture_summary_on_with_assist" msgid="8670153838520237089"></string> |
2016 | 2020 | <string name="language_input_gesture_summary_on_non_assist" msgid="2738661322747920463"></string> |
@@ -2011,6 +2011,10 @@ | ||
2011 | 2011 | <string name="runningservicedetails_stop_dlg_title" msgid="6201041461740445113">"停止系統服務?"</string> |
2012 | 2012 | <string name="runningservicedetails_stop_dlg_text" product="tablet" msgid="2076922609580490122">"如果你停用這項服務,你的平板電腦上的某些功能可能無法正常運作,待你重新開機後才會恢復正常。"</string> |
2013 | 2013 | <string name="runningservicedetails_stop_dlg_text" product="default" msgid="2625863973434309085">"如果你停用這項服務,你的手機上的某些功能可能無法正常運作,待你重新開機後才會恢復正常。"</string> |
2014 | + <string name="android_x86_options_title">"Android-x86 設定"</string> | |
2015 | + <string name="android_x86_dashboard_summary">原生相容模式、統計</string> | |
2016 | + <string name="nativebridge_toggle_title">"原生相容模式"</string> | |
2017 | + <string name="nativebridge_toggle_summary">"可相容於使用 arm 原生函式庫的應用程式"</string> | |
2014 | 2018 | <string name="language_input_gesture_title" msgid="3292455685728572960">"語言、輸入和手勢"</string> |
2015 | 2019 | <string name="language_input_gesture_summary_on_with_assist" msgid="8670153838520237089"></string> |
2016 | 2020 | <string name="language_input_gesture_summary_on_non_assist" msgid="2738661322747920463"></string> |
@@ -4664,6 +4664,12 @@ | ||
4664 | 4664 | features of your phone may stop working correctly until you power it off |
4665 | 4665 | and then on again.</string> |
4666 | 4666 | |
4667 | + <!-- Android-x86 settings --> | |
4668 | + <string name="android_x86_options_title">Android-x86 options</string> | |
4669 | + <string name="android_x86_dashboard_summary">Native bridge, statistics</string> | |
4670 | + <string name="nativebridge_toggle_title">Enable native bridge</string> | |
4671 | + <string name="nativebridge_toggle_summary">To support apps with arm native libraries</string> | |
4672 | + | |
4667 | 4673 | <!-- Languages Settings --> <skip /> |
4668 | 4674 | <!-- Title of Language, input & gestures setting on main settings screen. --> |
4669 | 4675 | <string name="language_input_gesture_title">Languages, input & gestures</string> |
@@ -0,0 +1,26 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<!-- Copyright (C) 2015 The Android-x86 Open Source Project | |
3 | + | |
4 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + you may not use this file except in compliance with the License. | |
6 | + You may obtain a copy of the License at | |
7 | + | |
8 | + http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + | |
10 | + Unless required by applicable law or agreed to in writing, software | |
11 | + distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + See the License for the specific language governing permissions and | |
14 | + limitations under the License. | |
15 | +--> | |
16 | + | |
17 | +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" | |
18 | + xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" | |
19 | + android:title="@string/android_x86_options_title"> | |
20 | + | |
21 | + <SwitchPreference android:key="toggle_nb" | |
22 | + android:title="@string/nativebridge_toggle_title" | |
23 | + android:summary="@string/nativebridge_toggle_summary" | |
24 | + android:persistent="false" /> | |
25 | + | |
26 | +</PreferenceScreen> |
@@ -98,6 +98,7 @@ public class Settings extends SettingsActivity { | ||
98 | 98 | public static class MyDeviceInfoActivity extends SettingsActivity { /* empty */ } |
99 | 99 | public static class ModuleLicensesActivity extends SettingsActivity { /* empty */ } |
100 | 100 | public static class ApplicationSettingsActivity extends SettingsActivity { /* empty */ } |
101 | + public static class AndroidX86DashboardActivity extends SettingsActivity { /* empty */ } | |
101 | 102 | public static class ManageApplicationsActivity extends SettingsActivity { /* empty */ } |
102 | 103 | public static class ManageAssistActivity extends SettingsActivity { /* empty */ } |
103 | 104 | public static class HighPowerApplicationsActivity extends SettingsActivity { /* empty */ } |
@@ -140,6 +140,7 @@ import com.android.settings.security.SecuritySettings; | ||
140 | 140 | import com.android.settings.shortcut.CreateShortcut; |
141 | 141 | import com.android.settings.sound.MediaControlsSettings; |
142 | 142 | import com.android.settings.support.SupportDashboardActivity; |
143 | +import com.android.settings.system.AndroidX86DashboardFragment; | |
143 | 144 | import com.android.settings.system.ResetDashboardFragment; |
144 | 145 | import com.android.settings.system.SystemDashboardFragment; |
145 | 146 | import com.android.settings.tts.TextToSpeechSettings; |
@@ -290,6 +291,7 @@ public class SettingsGateway { | ||
290 | 291 | AppAndNotificationDashboardFragment.class.getName(), |
291 | 292 | WifiCallingDisclaimerFragment.class.getName(), |
292 | 293 | AccountDashboardFragment.class.getName(), |
294 | + AndroidX86DashboardFragment.class.getName(), | |
293 | 295 | EnterprisePrivacySettings.class.getName(), |
294 | 296 | WebViewAppPicker.class.getName(), |
295 | 297 | LockscreenDashboardFragment.class.getName(), |
@@ -315,6 +317,7 @@ public class SettingsGateway { | ||
315 | 317 | Settings.NetworkDashboardActivity.class.getName(), |
316 | 318 | Settings.ConnectedDeviceDashboardActivity.class.getName(), |
317 | 319 | Settings.AppAndNotificationDashboardActivity.class.getName(), |
320 | + Settings.AndroidX86DashboardActivity.class.getName(), | |
318 | 321 | Settings.DisplaySettingsActivity.class.getName(), |
319 | 322 | Settings.SoundSettingsActivity.class.getName(), |
320 | 323 | Settings.StorageDashboardActivity.class.getName(), |
@@ -0,0 +1,55 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2018 The Android-x86 Open Source Project | |
3 | + * | |
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | + * you may not use this file except in compliance with the License. | |
6 | + * You may obtain a copy of the License at | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | + * Unless required by applicable law or agreed to in writing, software | |
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | + * See the License for the specific language governing permissions and | |
14 | + * limitations under the License. | |
15 | + */ | |
16 | + | |
17 | +package com.android.settings.system; | |
18 | + | |
19 | +import android.os.Bundle; | |
20 | +import android.os.SystemProperties; | |
21 | +import androidx.preference.Preference; | |
22 | +import androidx.preference.SwitchPreference; | |
23 | +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; | |
24 | +import com.android.settings.R; | |
25 | +import com.android.settings.SettingsPreferenceFragment; | |
26 | + | |
27 | +public class AndroidX86DashboardFragment extends SettingsPreferenceFragment { | |
28 | + | |
29 | + private SwitchPreference mNativeBridgePreference; | |
30 | + | |
31 | + private static final String KEY_TOGGLE_NB = "toggle_nb"; | |
32 | + private static final String PROPERTY_NATIVEBRIDGE = "persist.sys.nativebridge"; | |
33 | + | |
34 | + @Override | |
35 | + public void onCreate(Bundle icicle) { | |
36 | + super.onCreate(icicle); | |
37 | + | |
38 | + addPreferencesFromResource(R.xml.android_x86_options); | |
39 | + mNativeBridgePreference = (SwitchPreference) findPreference(KEY_TOGGLE_NB); | |
40 | + mNativeBridgePreference.setChecked(SystemProperties.getBoolean(PROPERTY_NATIVEBRIDGE, false)); | |
41 | + } | |
42 | + | |
43 | + @Override | |
44 | + public boolean onPreferenceTreeClick(Preference preference) { | |
45 | + if (preference == mNativeBridgePreference) { | |
46 | + SystemProperties.set(PROPERTY_NATIVEBRIDGE, mNativeBridgePreference.isChecked() ? "1" : "0"); | |
47 | + } | |
48 | + return super.onPreferenceTreeClick(preference); | |
49 | + } | |
50 | + | |
51 | + @Override | |
52 | + public int getMetricsCategory() { | |
53 | + return MetricsEvent.APPLICATION; | |
54 | + } | |
55 | +} |