From 60a3cecc4c9862f35d81a7346eb54bbfaf2712c1 Mon Sep 17 00:00:00 2001 From: yumeng Date: Fri, 2 Sep 2016 16:19:34 +0800 Subject: [PATCH 01/37] Settings: Occurred "com.android.settings" force close 15 times at java.lang.IllegalArgumentException: cannot apply policy to UID 1001000 at monkey test mode. add pretection for monkey test mode. Change-Id: Ib6a76d44b8f46e2f4cfc1bf57ece0438c5bcdb5b CRs-Fixed: 1051409 --- src/com/android/settings/datausage/AppDataUsage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/settings/datausage/AppDataUsage.java b/src/com/android/settings/datausage/AppDataUsage.java index a9db9da16a..70e2c1f27b 100755 --- a/src/com/android/settings/datausage/AppDataUsage.java +++ b/src/com/android/settings/datausage/AppDataUsage.java @@ -251,6 +251,9 @@ public void onPause() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { + if (com.android.settings.Utils.isMonkeyRunning()) { + return false; + } if (preference == mRestrictBackground) { mDataSaverBackend.setIsBlacklisted(mAppItem.key, mPackageName, !(Boolean) newValue); return true; From d6e9d3abe21fb2169d9009b0366ce4c9d1ed6899 Mon Sep 17 00:00:00 2001 From: Jian Zhou Date: Mon, 5 Sep 2016 14:49:55 +0800 Subject: [PATCH 02/37] Settings : fix force close in monkey test Settings force close because of null pointer in monkey test. Add null pointer protect in DataUsageSummary. Change-Id: I507911d73cdc61ec1a84d08062138d4baa7fcf66 CRs-Fixed: 1049728 --- src/com/android/settings/datausage/DataUsageSummary.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java index c9ef257c18..cdf61ca9ed 100755 --- a/src/com/android/settings/datausage/DataUsageSummary.java +++ b/src/com/android/settings/datausage/DataUsageSummary.java @@ -134,6 +134,10 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onPrepareOptionsMenu(Menu menu) { final Context context = getActivity(); final MenuItem networkaccess = menu.findItem(R.id.data_usage_menu_app_network_access); + if (networkaccess == null) { + return; + } + if (context.getResources().getBoolean(R.bool.config_app_network_access_enabled)) { networkaccess.setVisible(true); } else { From 0a385ea752f39e1f2447976b35511d186c5c7406 Mon Sep 17 00:00:00 2001 From: Jian Zhou Date: Tue, 6 Sep 2016 18:45:40 +0800 Subject: [PATCH 03/37] Settings: Fix settings force close in monkey test. UnrestrictedDataAccess null pointer causes settings force close in monkey test. Add null pointer protect. CRs-Fixed: 1057528 Change-Id: I6a98c92e3f28639db7985d7c7331be0465c81f76 --- src/com/android/settings/datausage/UnrestrictedDataAccess.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/com/android/settings/datausage/UnrestrictedDataAccess.java diff --git a/src/com/android/settings/datausage/UnrestrictedDataAccess.java b/src/com/android/settings/datausage/UnrestrictedDataAccess.java old mode 100644 new mode 100755 index cab4551f1e..42e4df8bae --- a/src/com/android/settings/datausage/UnrestrictedDataAccess.java +++ b/src/com/android/settings/datausage/UnrestrictedDataAccess.java @@ -250,7 +250,7 @@ public void onDetached() { @Override protected void onClick() { - if (mState.isDataSaverBlacklisted) { + if (mState != null && mState.isDataSaverBlacklisted) { // app is blacklisted, launch App Data Usage screen InstalledAppDetails.startAppInfoFragment(AppDataUsage.class, getContext().getString(R.string.app_data_usage), From d5300b25a04a41c7a63106078c30700253fabdbc Mon Sep 17 00:00:00 2001 From: Fang Yunong Date: Thu, 20 Oct 2016 16:40:15 +0800 Subject: [PATCH 04/37] Settings: Add TMO control config for new code. Close WiFi network when enable USB Tethering. Change-Id: Ic3dd7cf7b4fa746b21d7ed96df0809f4e99aedb0 CRs-Fixed: 1070422 --- src/com/android/settings/TetherSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java index 74d2d58d9a..d9cf21075c 100644 --- a/src/com/android/settings/TetherSettings.java +++ b/src/com/android/settings/TetherSettings.java @@ -728,7 +728,7 @@ private void startTethering(int choice) { } if (choice == TETHERING_USB) { - if(mUsbTether.isChecked()) { + if(mUsbTether.isChecked() && mUsbEnable) { mWifiManager.setWifiEnabled(false); } } From 85ab0b27a1a5d8ba65715c47c6516b6e23165c61 Mon Sep 17 00:00:00 2001 From: Venkata Jagadeesh Garaga Date: Fri, 23 Sep 2016 15:45:16 +0530 Subject: [PATCH 05/37] Bluetooth Settings: Activity getting destroyed during orientation Handle screeen orientation for bluetooth settings Change-Id: Ifccd4bb020f159309d44133ea752b13abeafd748 CRs-Fixed: 1072143 --- AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index da1b723659..071aebce01 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -422,6 +422,7 @@ From c6115fcfce594ea455ce324d3449cac4717c09af Mon Sep 17 00:00:00 2001 From: Yue Liang Date: Tue, 25 Oct 2016 11:11:10 +0800 Subject: [PATCH 06/37] HotSpot learning after initialize activated When user activated hotspot as initialize, will pop-up for learning, customer chooses YES option, then show learning. Change-Id: Ie8cf5080c637e342c17e9bc5a06814cc73ce9fdd CRs-Fixed: 1070422 --- res/values/config.xml | 1 + res/values/strings.xml | 32 +++++++++- src/com/android/settings/TetherSettings.java | 35 +++++------ .../android/settings/wifi/WifiApEnabler.java | 59 ++++++++++++++++++- 4 files changed, 103 insertions(+), 24 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index 4ff24191da..2f91fc4e5b 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -91,4 +91,5 @@ false false + false diff --git a/res/values/strings.xml b/res/values/strings.xml index ee47bf816f..2cd869058c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7589,7 +7589,7 @@ No SIM Card Please install SIM card in order to share your data connection with other devices using Mobile HotSpot or USB tethering for Internet access. Mobile HotSpot - Set up Mobile HotSpot at the First Use + Set up Wi-Fi hotspot at the First Use LTE data and Voice Calling (IMS/VoLTE) service enabled LTE data service enabled Turn off Wi-Fi @@ -7598,8 +7598,36 @@ Show battery percentage Show battery level percentage inside the status bar - First Time Notification Use + USB tethering is activated Would you like to learn more about USB Tethering on your phone? Mobile HotSpot Help You can tether your Android device to your computer with a USB cable, to share your device\'s Internet connection with your computer. \n\n1. USB tethering works with Windows Vista, Windows 7, and Linux, the USB drivers for tethering may be needed.\n\n2. If your device has an SD card or USB storage, you can\'t mount it on your computer when USB tethered + Mobile HotSpot Help + You can turn your Android device into a portable Wi-Fi hotspot, to share your Android device\'s Internet connection with one or more computers or other devices. \n\n1.When your device is serving as a Wi-Fi hotspot, you can not use your device\'s applications to access the Internet via its Wi-Fi connection (but of course you remain connected to the Internet via your mobile data network). \n\n2.You configure the hotspot with the Wi-Fi hotspot settings + + Status + + Information + Very large font size will only be applied in specific applications.Large font size will be applied in all other application + Do not show this again + OK + Minimum + Small + Medium + Large + VeryLarge + + Set Maximum Connections + YES + NO + Your HotSpot is not visible now + If you switch the Broadcast Network Name (SSID) option off, your phone will not be visible to other devices and will not appear in the list of available Wi-Fi networks. Other devices can still connect to your HotSpot by entering its network name manually. + Hardware Feedback + Qualcomm Technologies Reporting + com.qti.smq.snapdragonSettings + com.qti.smq.qualcommFeedback + com.qti.smq.ui.QtiFeedbackActivity + + Wi-Fi tethering is activated + Would you like to learn more about wifi Tethering on your phone? diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java index d9cf21075c..4e53659292 100644 --- a/src/com/android/settings/TetherSettings.java +++ b/src/com/android/settings/TetherSettings.java @@ -157,7 +157,6 @@ public class TetherSettings extends RestrictedSettingsFragment private boolean mUsbEnable = false; private WifiManager mWifiStatusManager; private boolean mIsWifiEnabled = false; - private boolean mHaveWifiApConfig = false; @Override protected int getMetricsCategory() { @@ -283,24 +282,6 @@ public boolean onPreferenceClick(Preference preference) { Context.WIFI_SERVICE); } - @Override - public void onResume() { - super.onResume(); - if(mWifiManager != null) { - WifiConfiguration config = mWifiManager.getWifiApConfiguration(); - boolean isNotNoneSecurity = config.getAuthType() > WifiConfiguration.KeyMgmt.NONE; - // WifiConfiguration.KeyMgmt be used to management schemes, - // WifiConfiguration.preSharedKey for use with WPA-PSK, it's password, - // if preSharedKey is empty, the WifiConfiguration need to set password. - if(isNotNoneSecurity) { - mHaveWifiApConfig = config.preSharedKey != null && - !config.preSharedKey.isEmpty(); - } else { - mHaveWifiApConfig = true; - } - } - } - @Override public void onDestroy() { mDataSaverBackend.remListener(this); @@ -628,6 +609,20 @@ private boolean isSimCardReady( == TelephonyManager.SIM_STATE_READY); } + private boolean checkWifiApConfig() { + WifiConfiguration config = mWifiManager.getWifiApConfiguration(); + boolean isNotNoneSecurity = config.getAuthType() > WifiConfiguration.KeyMgmt.NONE; + // WifiConfiguration.KeyMgmt be used to management schemes, + // WifiConfiguration.preSharedKey for use with WPA-PSK, it's password, + // if preSharedKey is empty, the WifiConfiguration need to set password. + if(isNotNoneSecurity) { + return config.preSharedKey != null && + !config.preSharedKey.isEmpty(); + } else { + return true; + } + } + @Override public boolean onPreferenceChange(Preference preference, Object value) { boolean enable = (Boolean) value; @@ -638,7 +633,7 @@ public boolean onPreferenceChange(Preference preference, Object value) { ((HotspotPreference)preference).setChecked(false); return false; } else if(enableWifiApSettingsExt && - (isNeedShowHelp(getPrefContext()) || !mHaveWifiApConfig)) { + (isNeedShowHelp(getPrefContext()) || !checkWifiApConfig())) { Intent intent = new Intent(); intent.setAction(ACTION_HOTSPOT_PRE_CONFIGURE); intent.setPackage("com.qualcomm.qti.extsettings"); diff --git a/src/com/android/settings/wifi/WifiApEnabler.java b/src/com/android/settings/wifi/WifiApEnabler.java index 0dc82c1828..41073125b8 100644 --- a/src/com/android/settings/wifi/WifiApEnabler.java +++ b/src/com/android/settings/wifi/WifiApEnabler.java @@ -16,10 +16,14 @@ package com.android.settings.wifi; +import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.content.DialogInterface; import android.net.ConnectivityManager; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; @@ -28,10 +32,12 @@ import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; import com.android.settings.HotspotPreference; +import com.android.settings.TetherSettings; import com.android.settings.R; import com.android.settings.datausage.DataSaverBackend; import com.android.settingslib.TetherUtil; - +import android.app.AlertDialog; +import android.app.Dialog; import java.util.ArrayList; public class WifiApEnabler { @@ -48,7 +54,9 @@ public class WifiApEnabler { private boolean mEnabling = false; private static final String ACTION_HOTSPOT_POST_CONFIGURE = "Hotspot_PostConfigure"; private static final String ACTION_EXTRA = "choice"; - public static final int TETHERING_WIFI = 0; + private static final String KEY_FIRST_HOTSPOT_ACTIVATED = "FirstHotspotActivated"; + private static final String MY_PREF_FILE = "MY_PERFS"; + public static final int TETHERING_WIFI = 0; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override @@ -164,6 +172,52 @@ private void updateTetherState(Object[] available, Object[] tethered, Object[] e } } + private void showWifiTetheringLearning(final Context ctx) { + final AlertDialog.Builder builder = new AlertDialog.Builder(ctx); + builder.setTitle(ctx.getResources().getString(R.string.mobile_hotspot_help_dialog_title)); + builder.setMessage(ctx.getResources().getString(R.string.mobile_hotspot_help_dialog_text)); + builder.setPositiveButton(ctx.getResources().getString(R.string.yes), null); + builder.setCancelable(false); + builder.show(); + } + + + private void showWifiTetheringActivatedDialog(final Context ctx) { + final AlertDialog.Builder builder = new AlertDialog.Builder(ctx); + builder.setTitle(ctx.getResources().getString(R.string.learn_hotspot_dialog_title)); + builder.setMessage(ctx.getResources().getString(R.string.learn_hotspot_dialog_text)); + builder.setPositiveButton(ctx.getResources().getString(R.string.yes), + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface arg0, int arg1) { + showWifiTetheringLearning(ctx); + } + }); + builder.setNegativeButton(ctx.getResources().getString(R.string.skip_label), null); + builder.setCancelable(false); + builder.show(); + } + + private boolean isNeedShowActivated (final Context ctx) { + SharedPreferences sharedPreferences = ctx.getSharedPreferences( + MY_PREF_FILE, Activity.MODE_PRIVATE); + Editor editor = sharedPreferences.edit(); + boolean isFirstUse = sharedPreferences.getBoolean(KEY_FIRST_HOTSPOT_ACTIVATED,true); + if (isFirstUse) { + editor = sharedPreferences.edit(); + editor.putBoolean(KEY_FIRST_HOTSPOT_ACTIVATED, false); + editor.commit(); + } + return isFirstUse; + } + + private void showActivatedDialog(final Context ctx) { + if (ctx.getResources().getBoolean(R.bool.config_hotspot_need_show_activated_dialog) + && isNeedShowActivated(ctx)) { + showWifiTetheringActivatedDialog(ctx); + } + } + private void handleWifiApStateChanged(int state, int reason) { boolean enableWifiApSettingsExt = mContext.getResources().getBoolean( R.bool.show_wifi_hotspot_settings); @@ -183,6 +237,7 @@ private void handleWifiApStateChanged(int state, int reason) { hSwitch.setChecked(true); /* Doesnt need the airplane check */ hSwitch.setEnabled(!mDataSaverBackend.isDataSaverEnabled()); + showActivatedDialog(mContext); break; case WifiManager.WIFI_AP_STATE_DISABLING: hSwitch.setSummary(R.string.wifi_tether_stopping); From 217714219cc411d5437305070ea5a50b92deffaf Mon Sep 17 00:00:00 2001 From: Yue Liang Date: Wed, 26 Oct 2016 15:46:10 +0800 Subject: [PATCH 07/37] HotSpot: Mandatory Inactivity timer options The device must have an inactivity timer for Mobile HotSpot. The default option out of the box must be the Disable after 10 min of inactivity option. Change-Id: Ic91afe656477c4012d78a3d53669fa6b227c8bac CRs-Fixed: 1070422 --- res/values/config.xml | 2 ++ res/values/strings.xml | 1 + src/com/android/settings/TetherSettings.java | 2 ++ 3 files changed, 5 insertions(+) diff --git a/res/values/config.xml b/res/values/config.xml index 2f91fc4e5b..f1c9a4046f 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -92,4 +92,6 @@ false false + false + false diff --git a/res/values/strings.xml b/res/values/strings.xml index 2cd869058c..ba3fff7caf 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7630,4 +7630,5 @@ Wi-Fi tethering is activated Would you like to learn more about wifi Tethering on your phone? + With Open security, any device can connect to your Mobile HotSpot and use your mobile data connection. diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java index 4e53659292..0554952973 100644 --- a/src/com/android/settings/TetherSettings.java +++ b/src/com/android/settings/TetherSettings.java @@ -742,6 +742,8 @@ public boolean onPreferenceTreeClick(Preference preference) { } if (isFirstUseUSBTethering(getActivity())) { showFirstUseUSBTetheringDialog(getActivity()); + } else if(checkWifiConnectivityState(getActivity())) { + showTurnOffWifiDialog(getActivity()); } startTethering(TETHERING_USB); } else { From 3f3c906ed9141741bd2a798932a7fd45371f63d5 Mon Sep 17 00:00:00 2001 From: guangl Date: Fri, 28 Oct 2016 11:26:05 +0800 Subject: [PATCH 08/37] Settings: APN value change to "Not set" and APN disappeared Fix APN value change to "Not set" and APN disappeared from APN list after rotating screen. EditTextPreference's value is null when rotate screen. Change-Id: I46a101022f677a83b38bbcc4c88b2d8195c5ab18 CRs-Fixed: 1082388 --- AndroidManifest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 071aebce01..755ec12824 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2015,7 +2015,8 @@ android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> + android:label="@string/apn_edit" + android:configChanges="orientation|keyboardHidden|screenSize"> From e433647b7457488eab77d5d77d6cfe294c9b3daa Mon Sep 17 00:00:00 2001 From: Fang Yunong Date: Thu, 29 Sep 2016 16:01:26 +0800 Subject: [PATCH 09/37] Settings:Change the way of email account displayed Show only the default mailbox account with the system in list,hide others. Change-Id: I5a86ed19c06c55032a6d4a7ddac30466885b57bd CRs-fixed: 1071041 --- res/values/arrays.xml | 50 +++-------------------------- src/com/android/settings/Utils.java | 10 +++--- 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 79c165d663..5e37c99941 100755 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1084,51 +1084,11 @@ 45507 - - - com.qualcomm.qti.RIDL - com.android.localphone - com.android.sim - com.android.wanadoo - com.android.orangemail - com.android.correoorange - com.android.orangemobile - com.android.multibox - com.android.belgacom - com.android.skynet - com.android.telenet - com.android.scarlet - com.android.euphony - com.android.voo - com.android.tele2 - com.android.versatel - com.android.tiscali - com.android.swing - com.android.versatelasdl - com.android.brutele - com.android.teledisnet - com.android.tvcablenet - com.android.mobistar - com.android.vodafone - com.android.hotmail - com.android.sapo - com.android.netcabo - com.android.clix - com.android.alice - com.android.yahoo - com.android.outlook - com.android.gmail - com.android.aol - com.android.free - com.android.laposte - com.android.sfr - com.android.orange - com.android.noos - com.android.vodafone - com.android.hotmail - com.android.sapo - com.android.netcabo - com.android.clix + + + com.android.exchange + com.google + com.android.email diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index a010047bf4..07f49465af 100755 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -794,13 +794,13 @@ public static boolean showSimCardTile(Context context) { * Returns if need show the account with the given account type. */ public static boolean showAccount(Context context, String accountType) { - String[] hideAccounts = context.getResources().getStringArray(R.array.hide_account_list); - if (hideAccounts == null || hideAccounts.length == 0) return true; + String[] showAccounts = context.getResources().getStringArray(R.array.show_account_list); + if (showAccounts == null || showAccounts.length == 0) return false; - for (String account : hideAccounts) { - if (account.equals(accountType)) return false; + for (String account : showAccounts) { + if (account.equals(accountType)) return true; } - return true; + return false; } /** From 3afa6e6db5e735c7634d7321d52f3aa580b777e8 Mon Sep 17 00:00:00 2001 From: Zhaolei Date: Wed, 2 Nov 2016 09:45:22 +0800 Subject: [PATCH 10/37] Settings: Fix settings force close in monkey test. Unable to start activity ComponentInfo{../...settings.SubSettings}: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup. Forece close caused by mUnmount is null. Add check to avoid. Change-Id: I4e4e2568f488b79e2090de27ca05858467927474 CRs-Fixed: 1084021 --- .../settings/deviceinfo/PublicVolumeSettings.java | 10 ++++++++++ 1 file changed, 10 insertions(+) mode change 100644 => 100755 src/com/android/settings/deviceinfo/PublicVolumeSettings.java diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java old mode 100644 new mode 100755 index eee7673489..0100c66338 --- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java +++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java @@ -135,6 +135,16 @@ public void onActivityCreated(Bundle savedInstanceState) { final ViewGroup buttonBar = getButtonBar(); buttonBar.removeAllViews(); buttonBar.setPadding(padding, padding, padding, padding); + + //Fixed monkey test issue + //Settings crash caused by null pointer parameter + //Add check with mUnmount's values + if (null == mUnmount) { + mUnmount = new Button(getActivity()); + mUnmount.setText(R.string.storage_menu_unmount); + mUnmount.setOnClickListener(mUnmountListener); + } + buttonBar.addView(mUnmount, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); From 93d6c19d794f2da07bed84470661e84db22940b8 Mon Sep 17 00:00:00 2001 From: Fang Yunong Date: Thu, 1 Sep 2016 18:45:48 +0800 Subject: [PATCH 11/37] Settings:Fix settings config of show video call total data usage Change to use the framework video call data usage config. Change-Id: Ie29246173e79249c1d37b8c678ad192ce1d524ef CRs-Fixed: 1039373 --- res/values/config.xml | 2 -- src/com/android/settings/datausage/DataUsageList.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/res/values/config.xml b/res/values/config.xml index f1c9a4046f..545952b820 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -46,8 +46,6 @@ false - false - false false diff --git a/src/com/android/settings/datausage/DataUsageList.java b/src/com/android/settings/datausage/DataUsageList.java index 5adf14ddbd..eb19624c8e 100755 --- a/src/com/android/settings/datausage/DataUsageList.java +++ b/src/com/android/settings/datausage/DataUsageList.java @@ -448,7 +448,7 @@ public void bindStats(NetworkStats stats, int[] restrictedUids) { collapseKey = uid; category = AppItem.CATEGORY_APP; } else if ((ai != null) && (uid == ai.uid) && getContext().getResources().getBoolean( - R.bool.config_video_call_datausage_enable)){ + com.android.internal.R.bool.config_video_call_datausage_enable)){ collapseKey = uid; category = AppItem.CATEGORY_APP; } else { From 1d5becb347c9ceea267a236a1b514b75f25409d5 Mon Sep 17 00:00:00 2001 From: Nalla Kartheek Date: Mon, 10 Oct 2016 10:49:40 +0530 Subject: [PATCH 12/37] Wifi: Check mAccessPoint object when adding network for EAP types AddNetwork dialog box require mAccessPoint object to know the EAP types. But this object shall not exist when user add a network. Hence add NULL check to prevent null pointer exception. Change-Id: Icec03e4c49638a7f1b645671aa31a96481071686 CRs-Fixed: 1075923 --- src/com/android/settings/wifi/WifiConfigController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 560131ae42..b96ba1758a 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -979,7 +979,10 @@ private void showEapFieldsByMethod(int eapMethod) { case WIFI_EAP_METHOD_SIM: case WIFI_EAP_METHOD_AKA: case WIFI_EAP_METHOD_AKA_PRIME: - WifiConfiguration config = mAccessPoint.getConfig(); + WifiConfiguration config = null; + if (mAccessPoint != null) { + config = mAccessPoint.getConfig(); + } ArrayAdapter eapSimAdapter = new ArrayAdapter( mContext, android.R.layout.simple_spinner_item, mSimDisplayNames.toArray(new String[mSimDisplayNames.size()]) From 30cfbec7b2a1d52d8011ac28013be317a59a51d0 Mon Sep 17 00:00:00 2001 From: Manjunatha Prabhu Date: Fri, 4 Nov 2016 17:55:02 +0530 Subject: [PATCH 13/37] Settings: SMS provisioning changes - Enable or Disable WiFi Calling preference in response to provisioning message sent by operator. - Added flag to control the feature. Change-Id: I0c6304c3f854e925a551e775ba05d1087e40bb20 CRs-Fixed: 1080231 --- res/values/config.xml | 3 +++ src/com/android/settings/WirelessSettings.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/res/values/config.xml b/res/values/config.xml index 545952b820..8a0e892fef 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -92,4 +92,7 @@ false false false + + + false diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java index 93894508c8..fa1b0b054f 100755 --- a/src/com/android/settings/WirelessSettings.java +++ b/src/com/android/settings/WirelessSettings.java @@ -125,9 +125,11 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde private UserManager mUm; boolean mIsNetworkSettingsAvailable = false; + boolean mProvisioningVWiFiEnabled = false; private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1; private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage"; + private final String KEY = "persist.sys.provisioning"; private Preference mButtonWfc; private boolean mEnhancedWFCSettingsEnabled = false; @@ -430,6 +432,16 @@ public boolean onPreferenceChange(Preference preference, Object value) { }); } else { mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS); + mProvisioningVWiFiEnabled = this.getResources(). + getBoolean(R.bool.config_provision_wificalling_pref); + if (mProvisioningVWiFiEnabled) { + String value = SystemProperties.get(KEY,"false"); + if (!Boolean.parseBoolean(value)) { + final Context context = getActivity(); + ImsManager.setWfcSetting(context, false); + } + mButtonWfc.setEnabled(Boolean.parseBoolean(value)); + } removePreference(KEY_WFC_ENHANCED_SETTINGS); } From 7f1e7c9ea305392db7d5d9308faf7a6d964528f1 Mon Sep 17 00:00:00 2001 From: Andrew Sapperstein Date: Mon, 2 May 2016 18:28:21 -0700 Subject: [PATCH 14/37] Null check intent before starting "learn more". It is possible in certain build configurations to have an invalid link. Instead of crashing, swallow the error and write to logs. BUG: 28381984 Fixes: 31246856 Change-Id: I19f20b96afb42758187707f1b86a5817e8d737a8 (cherry picked from commit 6561d4870f031395316cf2fc956f69c306f04ae4) (cherry picked from commit e56d2be0b289707f99dd7988d719150991dcdd80) (cherry picked from commit 82a34268e6100ee1f3dde218be49d8b38d247b91) --- .../settings/fingerprint/FingerprintEnrollIntroduction.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java index 4cbf9632d7..5b9d39876e 100644 --- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java +++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java @@ -187,6 +187,10 @@ private LearnMoreSpan(String url) { public void onClick(View widget) { Context ctx = widget.getContext(); Intent intent = HelpUtils.getHelpIntent(ctx, getURL(), ctx.getClass().getName()); + if (intent == null) { + Log.w(LearnMoreSpan.TAG, "Null help intent."); + return; + } try { // This needs to be startActivityForResult even though we do not care about the // actual result because the help app needs to know about who invoked it. From af150d54ab34578fda08bf5b4045b1fa9953f941 Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Thu, 1 Sep 2016 17:10:59 -0700 Subject: [PATCH 15/37] Remove help links when device is not provisioned. DO NOT MERGE Bug: 31246856 Change-Id: Id638de8ab1c6b815d62916a584892be84cabe1ae (cherry picked from commit d0a95da564df4c52ed7475af0d1833e95b0d746b) (cherry picked from commit 566da28d087bb560b9a676a48ee080e703f1afbf) --- .../fingerprint/FingerprintEnrollIntroduction.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java index 5b9d39876e..1719289cc1 100644 --- a/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java +++ b/src/com/android/settings/fingerprint/FingerprintEnrollIntroduction.java @@ -25,6 +25,7 @@ import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; +import android.provider.Settings.Global; import android.text.Annotation; import android.text.SpannableString; import android.text.SpannableStringBuilder; @@ -69,9 +70,15 @@ protected void onCreate(Bundle savedInstanceState) { final RecyclerItemAdapter adapter = (RecyclerItemAdapter) layout.getAdapter(); adapter.setOnItemSelectedListener(this); Item item = (Item) adapter.findItemById(R.id.fingerprint_introduction_message); + String linkUrl = getString(R.string.help_url_fingerprint); + if (Global.getInt(getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) { + // If the device is not provisioned, help intents from HelpUtils will be null, so don't + // show the link at all. + linkUrl = ""; + } item.setTitle(LearnMoreSpan.linkify( getText(R.string.security_settings_fingerprint_enroll_introduction_message), - getString(R.string.help_url_fingerprint))); + linkUrl)); // setupwizard library automatically sets the divider inset to // R.dimen.suw_items_icon_divider_inset. We adjust this back to 0 as we do not want // an inset within settings. From a4e07a9cf5eb03806266385f040cb5a3be7b3293 Mon Sep 17 00:00:00 2001 From: Yue Liang Date: Mon, 14 Nov 2016 18:44:25 +0800 Subject: [PATCH 16/37] Bug fix: Settings: HotspotPreference.java Phenomenon: User leave from TetherSettings after Hotspot activated and return to it later, HotspotPreference summary will show empty. Rootcause: HotspotPreference.onBindViewHolder will re-hold after user return to TehterSettings, but summary haven't latest record, so summary will show empty. Solution: Get HotspotPreference to retain the latest summary after setSummary be called. Change-Id: Ibc2728e47c938d74819198719087098ea9983ac2 CRs-Fixed: 1088843 --- .../android/settings/HotspotPreference.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/HotspotPreference.java b/src/com/android/settings/HotspotPreference.java index a8e979ca25..918ab4048b 100755 --- a/src/com/android/settings/HotspotPreference.java +++ b/src/com/android/settings/HotspotPreference.java @@ -48,7 +48,7 @@ public class HotspotPreference extends Preference implements OnCheckedChangeList private TextView mSubSummary; private Context mContext; private boolean mSwitchEnabled; - + private CharSequence mSummary; public HotspotPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mContext = context; @@ -67,11 +67,20 @@ public HotspotPreference(Context context) { @Override public void onBindViewHolder(PreferenceViewHolder view) { super.onBindViewHolder(view); - mSubSummary = (TextView) view.findViewById(R.id.subsummary); - mSubSummary.setVisibility(View.GONE); - mSwitch = (Switch) view.findViewById(R.id.switchWidget); - mSwitch.setOnCheckedChangeListener(this); - setChecked(mSwitchEnabled); + if (mSubSummary == null) { + mSubSummary = (TextView) view.findViewById(R.id.subsummary); + if (mSummary != null && !mSummary.toString().isEmpty()) { + mSubSummary.setVisibility(View.VISIBLE); + } else { + mSubSummary.setVisibility(View.GONE); + } + mSubSummary.setText(mSummary); + } + if (mSwitch == null) { + mSwitch = (Switch) view.findViewById(R.id.switchWidget); + mSwitch.setOnCheckedChangeListener(this); + setChecked(mSwitchEnabled); + } } @@ -81,6 +90,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } public void setSummary(CharSequence summary) { + mSummary = summary; if (mSubSummary == null) { return; } @@ -94,6 +104,6 @@ public void setChecked(boolean state) { mSwitch.setChecked(state); mSwitch.setOnCheckedChangeListener(this); } - mSwitchEnabled=state; + mSwitchEnabled = state; } } From 6d538dcfc42e119a6fcf7db5e66170f3a98e51a7 Mon Sep 17 00:00:00 2001 From: Wang Yimin Date: Tue, 15 Nov 2016 17:02:18 +0800 Subject: [PATCH 17/37] DeviceInfo:Add QGP Version For Global Pass Provisioning package 1.get qgp version value from persist file 2.Show qgp version under about phone Change-Id: I26e8c1e03ebc433fa201446e1a5677437bb69b8b CRs-Fixed: 1085926 --- .../android/settings/DeviceInfoSettings.java | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java index a6b0b22add..a8266bd57f 100755 --- a/src/com/android/settings/DeviceInfoSettings.java +++ b/src/com/android/settings/DeviceInfoSettings.java @@ -78,6 +78,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In private static final String KEY_QGP_VERSION = "qgp_version"; private static final String PROPERTY_QGP_VERSION = "persist.qgp.version"; private static final String MBN_VERSION_PATH = "/persist/speccfg/mbnversion"; + private static final String QGP_VERSION_PATH = "/persist/speccfg/qgpversion"; static final int TAPS_TO_BE_A_DEVELOPER = 7; @@ -126,10 +127,15 @@ public void onCreate(Bundle icicle) { setStringSummary(KEY_DEVICE_MODEL, Build.MODEL); setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY); findPreference(KEY_BUILD_NUMBER).setEnabled(true); - setValueSummary(KEY_QGP_VERSION, PROPERTY_QGP_VERSION); + //setValueSummary(KEY_QGP_VERSION, PROPERTY_QGP_VERSION); // Remove QGP Version if property is not present - removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_QGP_VERSION, - PROPERTY_QGP_VERSION); + //removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_QGP_VERSION, + // PROPERTY_QGP_VERSION); + String mQGPVersion = getQGPVersionValue(); + setStringSummary(KEY_QGP_VERSION, mQGPVersion); + if(mQGPVersion == null){ + getPreferenceScreen().removePreference(findPreference(KEY_QGP_VERSION)); + } findPreference(KEY_KERNEL_VERSION).setSummary(DeviceInfoUtils.customizeFormatKernelVersion( getResources().getBoolean(R.bool.def_hide_kernel_version_name))); String mMbnVersion = getMBNVersionValue(); @@ -391,6 +397,26 @@ private String getMBNVersionValue() { return mVersion; } + private String getQGPVersionValue() { + String mVersion = null; + + if (RegionalizationEnvironment.isSupported()) { + mRegionalizationService = RegionalizationEnvironment.getRegionalizationService(); + } + if(mRegionalizationService != null){ + try{ + if(!mRegionalizationService.checkFileExists(QGP_VERSION_PATH)) + return null; + if(mRegionalizationService.readFile(QGP_VERSION_PATH, "").size() > 0){ + mVersion = mRegionalizationService.readFile(QGP_VERSION_PATH, "").get(0); + } + Log.d(LOG_TAG,"read QGPVersion="+mVersion); + }catch (Exception e) { + Log.e(LOG_TAG, "IOException:"+ e.getMessage()); + } + } + return mVersion; + } private void setValueSummary(String preference, String property) { try { findPreference(preference).setSummary( From 9b54873af341b5f47bba6bfe23fabea58309d20d Mon Sep 17 00:00:00 2001 From: Fang Yunong Date: Wed, 23 Nov 2016 10:55:15 +0800 Subject: [PATCH 18/37] Settings:Show the missed Personal account Add the Personal account to show in show account list. Change-Id: Ie249882ca578fa1bd13874570fbca0494c2f5bac CRs-Fixed: 1091700 --- res/values/arrays.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 5e37c99941..39a05d8621 100755 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1088,7 +1088,8 @@ com.android.exchange com.google - com.android.email + com.android.email.legacy.imap + com.android.email.pop3 From 050dfc28726eb2fcc2dca7155db2d35e11e39a3c Mon Sep 17 00:00:00 2001 From: Prashant Srivastava Date: Thu, 27 Oct 2016 15:40:07 +0530 Subject: [PATCH 19/37] Settings: Operator specific sim icon customisation. -Adding Operator and generic SIM icons Change-Id: I4e2016af47ad125c42d3cc806b34a2f98d757453 CRs-Fixed: 1076380 --- .../accounts/AccountSyncSettings.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java index f8094740b5..271f805205 100644 --- a/src/com/android/settings/accounts/AccountSyncSettings.java +++ b/src/com/android/settings/accounts/AccountSyncSettings.java @@ -39,6 +39,8 @@ import android.os.UserManager; import android.support.v7.preference.Preference; import android.text.TextUtils; +import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -52,6 +54,7 @@ import com.google.android.collect.Lists; import com.android.internal.logging.MetricsProto.MetricsEvent; +import com.android.internal.telephony.OperatorSimInfo; import com.android.settings.R; import com.android.settings.Utils; import com.android.settingslib.RestrictedLockUtils; @@ -82,6 +85,9 @@ public class AccountSyncSettings extends AccountPreferenceBase { new ArrayList(); private ArrayList mInvisibleAdapters = Lists.newArrayList(); + private final String SIM1_ACCOUNT_NAME = "SIM1"; + private final String SIM2_ACCOUNT_NAME = "SIM2"; + @Override public Dialog onCreateDialog(final int id) { Dialog dialog = null; @@ -562,6 +568,20 @@ protected void onAuthDescriptionsUpdated() { if (mAccount != null) { mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type)); mProviderId.setText(getLabelForType(mAccount.type)); + //Sim Icon Customisation feature change + OperatorSimInfo operatorSimInfo = new OperatorSimInfo(getActivity(). + getApplicationContext()); + boolean isCustomSimFeatureEnabled = operatorSimInfo. + isOperatorFeatureEnabled(); + if (isCustomSimFeatureEnabled) { + String accountName = mAccount.name; + if (accountName.equalsIgnoreCase(SIM1_ACCOUNT_NAME)) { + showOperatorSimIcon(0, operatorSimInfo); + } else if (accountName.equalsIgnoreCase(SIM2_ACCOUNT_NAME)) { + showOperatorSimIcon(1, operatorSimInfo); + } + } + } } @@ -569,4 +589,18 @@ protected void onAuthDescriptionsUpdated() { protected int getHelpResource() { return R.string.help_url_accounts; } + + private void showOperatorSimIcon(int slotIndex, OperatorSimInfo operatorSimInfo) { + boolean isSimTypeOperator = operatorSimInfo.isSimTypeOperator(slotIndex); + if (isSimTypeOperator) { + mProviderIcon.setImageDrawable(operatorSimInfo.getOperatorDrawable()); + mUserId.setText(operatorSimInfo.getOperatorDisplayName()); + } else { + mProviderIcon.setImageDrawable(operatorSimInfo.getGenericSimDrawable()); + int subId = SubscriptionManager.getSubId(slotIndex)[0]; + String operatorName = TelephonyManager.from(getActivity(). + getApplicationContext()).getSimOperator(subId); + mUserId.setText(operatorName); + } + } } From 666a542736eb5554ad22d9f6e170eede050829b6 Mon Sep 17 00:00:00 2001 From: jianhuac Date: Tue, 29 Nov 2016 11:02:12 +0800 Subject: [PATCH 20/37] Settings: Lost cached BT devices in found devices list Turn off BT and then turn it on again, it will lose some devices in the list. This is because it doesn't add cached device into list, but just rebuild it. We nedd to add them into the list again. Change-Id: I2dadf9ddec045f3bd7cf7a04b9b0dc024e536530 CRs-Fixed: 1093008 --- .../settings/bluetooth/DeviceListPreferenceFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java index e6fcbcbae9..65b79ae4d7 100644 --- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java +++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java @@ -182,7 +182,6 @@ void createDevicePreference(CachedBluetoothDevice cachedDevice) { if (preference == null) { preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice); preference.setKey(key); - mDeviceListGroup.addPreference(preference); } else { // Tell the preference it is being re-used in case there is new info in the // cached device. @@ -190,6 +189,7 @@ void createDevicePreference(CachedBluetoothDevice cachedDevice) { } initDevicePreference(preference); + mDeviceListGroup.addPreference(preference); mDevicePreferenceMap.put(cachedDevice, preference); } From f014e31a178c6948c4f1d69960519864506d0e6e Mon Sep 17 00:00:00 2001 From: jianzhou Date: Tue, 22 Nov 2016 11:14:23 +0800 Subject: [PATCH 21/37] Settings : Fix settings option list can not show issues DashboardSummary does not set categories for adapter when building UI. Set categories for adapter in rebuildUI function. Remove unnecessary buildlogs files. Change-Id: I249976d5bcd53d27ff81946cf485d3e95d7cdc79 --- src/com/android/settings/dashboard/DashboardSummary.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java index 67e206d808..6dfc22ecb2 100644 --- a/src/com/android/settings/dashboard/DashboardSummary.java +++ b/src/com/android/settings/dashboard/DashboardSummary.java @@ -246,6 +246,10 @@ private void rebuildUI() { return; } + List categories = + ((SettingsActivity) getActivity()).getDashboardCategories(); + mAdapter.setCategories(categories); + // recheck to see if any suggestions have been changed. new SuggestionLoader().execute(); } From b380807bbe5aaf4b7a9db53f13a462c118def55e Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Thu, 1 Sep 2016 21:43:22 -0700 Subject: [PATCH 22/37] Revert "Telephony(MSIM): Support to launch SimSettings from vendor space" * This is silly to be delegated to a blob. This reverts commit 188be8eef8f3bd3235798fb8a864ee3b29439e10. Change-Id: If76a4cf992e9368b21d4d6d42d085020cd122c33 --- AndroidManifest.xml | 4 ++++ src/com/android/settings/SettingsActivity.java | 11 ----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 58bf19ff22..61fc80b619 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2978,6 +2978,10 @@ android:label="@string/sim_settings_title" android:icon="@drawable/ic_settings_sim" android:taskAffinity=""> + + + + diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 26e377780f..aeca8b0eac 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -1070,17 +1070,6 @@ private Fragment switchToFragment(String fragmentName, Bundle args, boolean vali return null; } - if (fragmentName.equals(SimSettings.class.getName())){ - Log.i(LOG_TAG, "switchToFragment, launch simSettings "); - Intent provisioningIntent = - new Intent("com.android.settings.sim.SIM_SUB_INFO_SETTINGS"); - if (!getPackageManager().queryIntentActivities(provisioningIntent, 0).isEmpty()) { - startActivity(provisioningIntent); - } - finish(); - return null; - } - if (LTE_4G_FRAGMENT.equals(fragmentName)) { Intent newIntent = new Intent("android.settings.SETTINGS"); newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); From a186055d09a45a0766b7689e66d51a02b0074dfa Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Tue, 29 Nov 2016 18:24:21 +0000 Subject: [PATCH 23/37] SimSettings: avoid NPE Don't assume getPhoneAccount doesn't return null just because you're passing a non-null argument. Avoids: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.telecom.PhoneAccount.getLabel()' on a null object reference at com.android.settings.sim.SimSettings.updateCallValues(SimSettings.java:299) at com.android.settings.sim.SimSettings.updateActivitesCategory(SimSettings.java:237) at com.android.settings.sim.SimSettings.updateAllOptions(SimSettings.java:222) at com.android.settings.sim.SimSettings.updateSubscriptions(SimSettings.java:217) at com.android.settings.sim.SimSettings.-wrap4(SimSettings.java) at com.android.settings.sim.SimSettings$1.onSubscriptionsChanged(SimSettings.java:175) at android.telephony.SubscriptionManager$OnSubscriptionsChangedListener$1.handleMessage(SubscriptionManager.java:397) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5461) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Change-Id: Ibdb5a978744a8f3e5dd916d08297a07d98aca5be --- src/com/android/settings/sim/SimSettings.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java index ece39136b5..52b37877fa 100644 --- a/src/com/android/settings/sim/SimSettings.java +++ b/src/com/android/settings/sim/SimSettings.java @@ -25,6 +25,7 @@ import android.provider.SearchIndexableResource; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; +import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; @@ -194,15 +195,19 @@ private void updateCellularDataValues() { private void updateCallValues() { final Preference simPref = findPreference(KEY_CALLS); final TelecomManager telecomManager = TelecomManager.from(mContext); - final PhoneAccountHandle phoneAccount = + final PhoneAccountHandle phoneAccountHandle = telecomManager.getUserSelectedOutgoingPhoneAccount(); final List allPhoneAccounts = telecomManager.getCallCapablePhoneAccounts(); simPref.setTitle(R.string.calls_title); + PhoneAccount phoneAccount = null; + if (phoneAccountHandle != null) { + phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle); + } simPref.setSummary(phoneAccount == null ? mContext.getResources().getString(R.string.sim_calls_ask_first_prefs_title) - : (String)telecomManager.getPhoneAccount(phoneAccount).getLabel()); + : (String)phoneAccount.getLabel()); simPref.setEnabled(allPhoneAccounts.size() > 1); } From cca5c467dccc5facb2fac1e5b492c36bcb6d04a3 Mon Sep 17 00:00:00 2001 From: Hamster Tian Date: Wed, 30 Apr 2014 16:11:31 +0200 Subject: [PATCH 24/37] [3/3] Add "Accept all files" option for incoming files via BT * Adapted for DU-M. * PS2: empty line fix * PS3: variable name fix BT server in AOSP will check MIME type of incoming file. Only those with explicitly allowed types will be accepted. The MIME type whitelist is in packages/apps/Bluetooth/src/com/android/bluetooth/opp/Constants.java But this can be annoying when we want to transfer RAR, APK or conf files etc which do not exist in the list. This patch adds the option "Accept all files" in Settings -> Bluetooth -> menu. This option is disabled by default, which ensures security. Change-Id: Idd2c438b4d0c0c6392e572e67b3ee9e8f9625282 --- res/values/custom_strings.xml | 25 +++++++++++++++++++ .../settings/bluetooth/BluetoothSettings.java | 16 ++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 res/values/custom_strings.xml diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml new file mode 100644 index 0000000000..bab971be55 --- /dev/null +++ b/res/values/custom_strings.xml @@ -0,0 +1,25 @@ + + + + + + Accept all file types + + diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index 5a4bf7dadf..31f7291d29 100644 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -80,6 +80,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem private static final int MENU_ID_SCAN = Menu.FIRST; private static final int MENU_ID_RENAME_DEVICE = Menu.FIRST + 1; private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 2; + private static final int MENU_ID_ACCEPT_ALL_FILES = Menu.FIRST + 3; /* Private intent to show the list of received files */ private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES = @@ -293,6 +294,10 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { boolean isDiscovering = mLocalAdapter.isDiscovering(); int textId = isDiscovering ? R.string.bluetooth_searching_for_devices : R.string.bluetooth_search_for_devices; + + boolean isAcceptAllFilesEnabled = Settings.System.getInt(getContentResolver(), + Settings.System.BLUETOOTH_ACCEPT_ALL_FILES, 0) == 1; + menu.add(Menu.NONE, MENU_ID_SCAN, 0, textId) .setEnabled(bluetoothIsEnabled && !isDiscovering) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); @@ -301,6 +306,10 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + menu.add(Menu.NONE, MENU_ID_ACCEPT_ALL_FILES, 0, R.string.bluetooth_accept_all_files) + .setCheckable(true) + .setChecked(isAcceptAllFilesEnabled) + .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); } @@ -325,6 +334,13 @@ public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES); getActivity().sendBroadcast(intent); return true; + + case MENU_ID_ACCEPT_ALL_FILES: + item.setChecked(!item.isChecked()); + Settings.System.putInt(getContentResolver(), + Settings.System.BLUETOOTH_ACCEPT_ALL_FILES, + item.isChecked() ? 1 : 0); + return true; } return super.onOptionsItemSelected(item); } From 97f3deb6ba122f3acdf90d594e8533846500a833 Mon Sep 17 00:00:00 2001 From: myfluxi Date: Tue, 22 Nov 2016 21:06:15 +0100 Subject: [PATCH 25/37] Settings: skip Misc/Overcounted battery stats in builds Quadruple battery lifez. Change-Id: I6f829dd62c8820a38f2ac1301e0fdc345852d1d3 --- src/com/android/settings/fuelgauge/PowerUsageSummary.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index 043a52bb61..60a6f06976 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -333,7 +333,7 @@ protected void refreshStats() { if (percentOfTotal < 10) { continue; } - if ("user".equals(Build.TYPE)) { + if ("user".equals(Build.TYPE) || "userdebug".equals(Build.TYPE)) { continue; } } @@ -346,7 +346,7 @@ protected void refreshStats() { if (percentOfTotal < 5) { continue; } - if ("user".equals(Build.TYPE)) { + if ("user".equals(Build.TYPE) || "userdebug".equals(Build.TYPE)) { continue; } } From 89776decdb170e90218b70c978d44dda41d2a84b Mon Sep 17 00:00:00 2001 From: Carlo Savignano Date: Sun, 27 Dec 2015 14:21:19 +0100 Subject: [PATCH 26/37] settings: Add buttons customization fragment * Add fragment for buttons related settings. PS3: Add Pixel UI color Change-Id: I057a7aa557dfe015058721ec1a5996ffecdea954 --- AndroidManifest.xml | 37 ++ res/drawable/ic_settings_buttons.xml | 31 ++ res/values/custom_arrays.xml | 42 ++ res/values/custom_strings.xml | 25 + res/xml/buttons_settings.xml | 165 ++++++ src/com/android/settings/ButtonsSettings.java | 476 ++++++++++++++++++ src/com/android/settings/Settings.java | 2 + .../android/settings/SettingsActivity.java | 4 +- src/com/android/settings/search/Ranking.java | 5 + .../search/SearchIndexableResources.java | 9 + 10 files changed, 795 insertions(+), 1 deletion(-) create mode 100644 res/drawable/ic_settings_buttons.xml create mode 100644 res/values/custom_arrays.xml create mode 100644 res/xml/buttons_settings.xml create mode 100644 src/com/android/settings/ButtonsSettings.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 61fc80b619..3862b668ee 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1061,6 +1061,43 @@ android:resource="@string/qtifeedback_settings_subtitle" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml new file mode 100644 index 0000000000..36ec9191dd --- /dev/null +++ b/res/values/custom_arrays.xml @@ -0,0 +1,42 @@ + + + + + + + @string/hardware_keys_action_nothing + @string/hardware_keys_action_menu + @string/hardware_keys_action_app_switch + @string/hardware_keys_action_search + @string/hardware_keys_action_voice_search + @string/hardware_keys_action_in_app_search + @string/hardware_keys_action_launch_camera + @string/hardware_keys_action_last_app + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml index bab971be55..a9cc16f959 100644 --- a/res/values/custom_strings.xml +++ b/res/values/custom_strings.xml @@ -3,6 +3,7 @@ /* ** Copyright 2007 The Android Open Source Project ** Copyright (C) 2012-2015 The CyanogenMod Project +** Copyright 2016 The ParanoidAndroid Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. @@ -22,4 +23,28 @@ Accept all file types + + Buttons + Enable software keys + Enable on-screen navigation keys + Backlight + Enable navigation keys backlight + Home button + Back button + Menu button + Assist button + Recents button + Camera button + Short press action + Long press action + Double tap action + No action + Open/close menu + Recents + Search assistant + Voice search + In-app search + Open camera + Launch last app + diff --git a/res/xml/buttons_settings.xml b/res/xml/buttons_settings.xml new file mode 100644 index 0000000000..7cf86d8f9f --- /dev/null +++ b/res/xml/buttons_settings.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/android/settings/ButtonsSettings.java b/src/com/android/settings/ButtonsSettings.java new file mode 100644 index 0000000000..3e59b66ea8 --- /dev/null +++ b/src/com/android/settings/ButtonsSettings.java @@ -0,0 +1,476 @@ +/* + * Copyright (C) 2014 ParanoidAndroid 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; + +import android.content.ContentResolver; +import android.content.Context; +import android.content.res.Resources; +import android.os.Bundle; +import android.os.RemoteException; +import android.os.Handler; +import android.os.UserHandle; +import android.os.UserManager; +import android.provider.SearchIndexableResource; +import android.provider.Settings; +import android.service.notification.ZenModeConfig; +import android.support.v7.preference.Preference; +import android.support.v7.preference.ListPreference; +import android.support.v7.preference.Preference.OnPreferenceChangeListener; +import android.support.v7.preference.PreferenceCategory; +import android.support.v7.preference.PreferenceScreen; +import android.support.v14.preference.SwitchPreference; +import android.util.Log; +import android.text.TextUtils; + +import com.android.settings.R; +import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settings.search.Indexable; +import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.Utils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ButtonsSettings extends SettingsPreferenceFragment implements + OnPreferenceChangeListener, Indexable { + private static final String TAG = "ButtonSettings"; + + private static final int KEY_MASK_HOME = 0x01; + private static final int KEY_MASK_BACK = 0x02; + private static final int KEY_MASK_MENU = 0x04; + private static final int KEY_MASK_ASSIST = 0x08; + private static final int KEY_MASK_APP_SWITCH = 0x10; + private static final int KEY_MASK_CAMERA = 0x20; + + private static final String KEY_NAVIGATION_BAR = "navigation_bar"; + private static final String KEY_BUTTON_BRIGHTNESS = "button_brightness"; + + private static final String KEY_HOME_LONG_PRESS = "hardware_keys_home_long_press"; + private static final String KEY_HOME_DOUBLE_TAP = "hardware_keys_home_double_tap"; + private static final String KEY_BACK_LONG_PRESS = "hardware_keys_back_long_press"; + private static final String KEY_BACK_DOUBLE_TAP = "hardware_keys_back_double_tap"; + private static final String KEY_MENU_LONG_PRESS = "hardware_keys_menu_long_press"; + private static final String KEY_MENU_DOUBLE_TAP = "hardware_keys_menu_double_tap"; + private static final String KEY_ASSIST_LONG_PRESS = "hardware_keys_assist_long_press"; + private static final String KEY_ASSIST_DOUBLE_TAP = "hardware_keys_assist_double_tap"; + private static final String KEY_APP_SWITCH_LONG_PRESS = "hardware_keys_app_switch_long_press"; + private static final String KEY_APP_SWITCH_DOUBLE_TAP = "hardware_keys_app_switch_double_tap"; + private static final String KEY_CAMERA_LONG_PRESS = "hardware_keys_camera_long_press"; + private static final String KEY_CAMERA_DOUBLE_TAP = "hardware_keys_camera_double_tap"; + + private static final String KEY_CATEGORY_HOME = "home_key"; + private static final String KEY_CATEGORY_BACK = "back_key"; + private static final String KEY_CATEGORY_MENU = "menu_key"; + private static final String KEY_CATEGORY_ASSIST = "assist_key"; + private static final String KEY_CATEGORY_APP_SWITCH = "app_switch_key"; + private static final String KEY_CATEGORY_CAMERA = "camera_key"; + + private static final String EMPTY_STRING = ""; + + private Handler mHandler; + + private int mDeviceHardwareKeys; + + private ListPreference mHomeLongPressAction; + private ListPreference mHomeDoubleTapAction; + private ListPreference mBackLongPressAction; + private ListPreference mBackDoubleTapAction; + private ListPreference mMenuLongPressAction; + private ListPreference mMenuDoubleTapAction; + private ListPreference mAssistLongPressAction; + private ListPreference mAssistDoubleTapAction; + private ListPreference mAppSwitchLongPressAction; + private ListPreference mAppSwitchDoubleTapAction; + private ListPreference mCameraLongPressAction; + private ListPreference mCameraDoubleTapAction; + + private SwitchPreference mNavigationBar; + private SwitchPreference mButtonBrightness; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.buttons_settings); + + mHandler = new Handler(); + + final Resources res = getActivity().getResources(); + final ContentResolver resolver = getActivity().getContentResolver(); + final PreferenceScreen prefScreen = getPreferenceScreen(); + + mDeviceHardwareKeys = res.getInteger( + com.android.internal.R.integer.config_deviceHardwareKeys); + + /* Navigation Bar */ + mNavigationBar = (SwitchPreference) findPreference(KEY_NAVIGATION_BAR); + if (mNavigationBar != null) { + mNavigationBar.setOnPreferenceChangeListener(this); + } + + /* Button Brightness */ + mButtonBrightness = (SwitchPreference) findPreference(KEY_BUTTON_BRIGHTNESS); + if (mButtonBrightness != null) { + int defaultButtonBrightness = res.getInteger( + com.android.internal.R.integer.config_buttonBrightnessSettingDefault); + if (defaultButtonBrightness > 0) { + mButtonBrightness.setOnPreferenceChangeListener(this); + } else { + prefScreen.removePreference(mButtonBrightness); + } + } + + /* Home Key Long Press */ + int defaultLongPressOnHardwareHomeBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnHomeKeyBehavior); + int longPressOnHardwareHomeBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_HOME_LONG_PRESS_ACTION, + defaultLongPressOnHardwareHomeBehavior, + UserHandle.USER_CURRENT); + mHomeLongPressAction = initActionList(KEY_HOME_LONG_PRESS, longPressOnHardwareHomeBehavior); + + /* Home Key Double Tap */ + int defaultDoubleTapOnHardwareHomeBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnHomeKeyBehavior); + int doubleTapOnHardwareHomeBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_HOME_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareHomeBehavior, + UserHandle.USER_CURRENT); + mHomeDoubleTapAction = initActionList(KEY_HOME_DOUBLE_TAP, doubleTapOnHardwareHomeBehavior); + + /* Back Key Long Press */ + int defaultLongPressOnHardwareBackBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnBackKeyBehavior); + int longPressOnHardwareBackBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_BACK_LONG_PRESS_ACTION, + defaultLongPressOnHardwareBackBehavior, + UserHandle.USER_CURRENT); + mBackLongPressAction = initActionList(KEY_BACK_LONG_PRESS, longPressOnHardwareBackBehavior); + + /* Back Key Double Tap */ + int defaultDoubleTapOnHardwareBackBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnBackKeyBehavior); + int doubleTapOnHardwareBackBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_BACK_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareBackBehavior, + UserHandle.USER_CURRENT); + mBackDoubleTapAction = initActionList(KEY_BACK_DOUBLE_TAP, doubleTapOnHardwareBackBehavior); + + /* Menu Key Long Press */ + int defaultLongPressOnHardwareMenuBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnMenuKeyBehavior); + int longPressOnHardwareMenuBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_MENU_LONG_PRESS_ACTION, + defaultLongPressOnHardwareMenuBehavior, + UserHandle.USER_CURRENT); + mMenuLongPressAction = initActionList(KEY_MENU_LONG_PRESS, longPressOnHardwareMenuBehavior); + + /* Menu Key Double Tap */ + int defaultDoubleTapOnHardwareMenuBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnMenuKeyBehavior); + int doubleTapOnHardwareMenuBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_MENU_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareMenuBehavior, + UserHandle.USER_CURRENT); + mMenuDoubleTapAction = initActionList(KEY_MENU_DOUBLE_TAP, doubleTapOnHardwareMenuBehavior); + + /* Assist Key Long Press */ + int defaultLongPressOnHardwareAssistBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnAssistKeyBehavior); + int longPressOnHardwareAssistBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_ASSIST_LONG_PRESS_ACTION, + defaultLongPressOnHardwareAssistBehavior, + UserHandle.USER_CURRENT); + mAssistLongPressAction = initActionList(KEY_ASSIST_LONG_PRESS, longPressOnHardwareAssistBehavior); + + /* Assist Key Double Tap */ + int defaultDoubleTapOnHardwareAssistBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnAssistKeyBehavior); + int doubleTapOnHardwareAssistBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_ASSIST_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareAssistBehavior, + UserHandle.USER_CURRENT); + mAssistDoubleTapAction = initActionList(KEY_ASSIST_DOUBLE_TAP, doubleTapOnHardwareAssistBehavior); + + /* AppSwitch Key Long Press */ + int defaultLongPressOnHardwareAppSwitchBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnAppSwitchKeyBehavior); + int longPressOnHardwareAppSwitchBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_APP_SWITCH_LONG_PRESS_ACTION, + defaultLongPressOnHardwareAppSwitchBehavior, + UserHandle.USER_CURRENT); + mAppSwitchLongPressAction = initActionList(KEY_APP_SWITCH_LONG_PRESS, longPressOnHardwareAppSwitchBehavior); + + /* AppSwitch Key Double Tap */ + int defaultDoubleTapOnHardwareAppSwitchBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnAppSwitchKeyBehavior); + int doubleTapOnHardwareAppSwitchBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_APP_SWITCH_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareAppSwitchBehavior, + UserHandle.USER_CURRENT); + mAppSwitchDoubleTapAction = initActionList(KEY_APP_SWITCH_DOUBLE_TAP, doubleTapOnHardwareAppSwitchBehavior); + + /* Camera Key Long Press */ + int defaultLongPressOnHardwareCameraBehavior = res.getInteger( + com.android.internal.R.integer.config_longPressOnCameraKeyBehavior); + int longPressOnHardwareCameraBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_CAMERA_LONG_PRESS_ACTION, + defaultLongPressOnHardwareCameraBehavior, + UserHandle.USER_CURRENT); + mCameraLongPressAction = initActionList(KEY_CAMERA_LONG_PRESS, longPressOnHardwareCameraBehavior); + + /* Camera Key Double Tap */ + int defaultDoubleTapOnHardwareCameraBehavior = res.getInteger( + com.android.internal.R.integer.config_doubleTapOnCameraKeyBehavior); + int doubleTapOnHardwareCameraBehavior = Settings.System.getIntForUser(resolver, + Settings.System.KEY_CAMERA_DOUBLE_TAP_ACTION, + defaultDoubleTapOnHardwareCameraBehavior, + UserHandle.USER_CURRENT); + mCameraDoubleTapAction = initActionList(KEY_CAMERA_DOUBLE_TAP, doubleTapOnHardwareCameraBehavior); + } + + @Override + public void onResume() { + super.onResume(); + reload(); + } + + @Override + protected int getMetricsCategory() { + return -1; + } + + private ListPreference initActionList(String key, int value) { + ListPreference list = (ListPreference) getPreferenceScreen().findPreference(key); + if (list != null) { + list.setValue(Integer.toString(value)); + list.setSummary(list.getEntry()); + list.setOnPreferenceChangeListener(this); + } + return list; + } + + private boolean handleOnPreferenceTreeClick(Preference preference) { + if (preference != null && preference == mNavigationBar) { + mNavigationBar.setEnabled(false); + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + mNavigationBar.setEnabled(true); + } + }, 1000); + return true; + } + return false; + } + + private boolean handleOnPreferenceChange(Preference preference, Object newValue) { + final String setting = getSystemPreferenceString(preference); + + if (TextUtils.isEmpty(setting)) { + // No system setting. + return false; + } + + if (preference != null && preference instanceof ListPreference) { + ListPreference listPref = (ListPreference) preference; + String value = (String) newValue; + int index = listPref.findIndexOfValue(value); + listPref.setSummary(listPref.getEntries()[index]); + Settings.System.putIntForUser(getContentResolver(), setting, Integer.valueOf(value), + UserHandle.USER_CURRENT); + } else if (preference != null && preference instanceof SwitchPreference) { + boolean state = false; + if (newValue instanceof Boolean) { + state = (Boolean) newValue; + } else if (newValue instanceof String) { + state = Integer.valueOf((String) newValue) != 0; + } + Settings.System.putIntForUser(getContentResolver(), setting, state ? 1 : 0, + UserHandle.USER_CURRENT); + } + + return true; + } + + private String getSystemPreferenceString(Preference preference) { + if (preference == null) { + return EMPTY_STRING; + } else if (preference == mNavigationBar) { + return Settings.System.NAVIGATION_BAR_ENABLED; + } else if (preference == mButtonBrightness) { + return Settings.System.BUTTON_BRIGHTNESS_ENABLED; + } else if (preference == mHomeLongPressAction) { + return Settings.System.KEY_HOME_LONG_PRESS_ACTION; + } else if (preference == mHomeDoubleTapAction) { + return Settings.System.KEY_HOME_DOUBLE_TAP_ACTION; + } else if (preference == mBackLongPressAction) { + return Settings.System.KEY_BACK_LONG_PRESS_ACTION; + } else if (preference == mBackDoubleTapAction) { + return Settings.System.KEY_BACK_DOUBLE_TAP_ACTION; + } else if (preference == mMenuLongPressAction) { + return Settings.System.KEY_MENU_LONG_PRESS_ACTION; + } else if (preference == mMenuDoubleTapAction) { + return Settings.System.KEY_MENU_DOUBLE_TAP_ACTION; + } else if (preference == mAssistLongPressAction) { + return Settings.System.KEY_ASSIST_LONG_PRESS_ACTION; + } else if (preference == mAssistDoubleTapAction) { + return Settings.System.KEY_ASSIST_DOUBLE_TAP_ACTION; + } else if (preference == mAppSwitchLongPressAction) { + return Settings.System.KEY_APP_SWITCH_LONG_PRESS_ACTION; + } else if (preference == mAppSwitchDoubleTapAction) { + return Settings.System.KEY_APP_SWITCH_DOUBLE_TAP_ACTION; + } else if (preference == mCameraLongPressAction) { + return Settings.System.KEY_CAMERA_LONG_PRESS_ACTION; + } else if (preference == mCameraDoubleTapAction) { + return Settings.System.KEY_CAMERA_DOUBLE_TAP_ACTION; + } + + return EMPTY_STRING; + } + + private void reload() { + final ContentResolver resolver = getActivity().getContentResolver(); + + final boolean hasHome = (mDeviceHardwareKeys & KEY_MASK_HOME) != 0; + final boolean hasMenu = (mDeviceHardwareKeys & KEY_MASK_MENU) != 0; + final boolean hasBack = (mDeviceHardwareKeys & KEY_MASK_BACK) != 0; + final boolean hasAssist = (mDeviceHardwareKeys & KEY_MASK_ASSIST) != 0; + final boolean hasAppSwitch = (mDeviceHardwareKeys & KEY_MASK_APP_SWITCH) != 0; + final boolean hasCamera = (mDeviceHardwareKeys & KEY_MASK_CAMERA) != 0; + + final boolean navigationBarEnabled = Settings.System.getIntForUser(resolver, + Settings.System.NAVIGATION_BAR_ENABLED, 0, UserHandle.USER_CURRENT) != 0; + + final boolean buttonBrightnessEnabled = Settings.System.getIntForUser(resolver, + Settings.System.BUTTON_BRIGHTNESS_ENABLED, 1, UserHandle.USER_CURRENT) != 0; + + if (mNavigationBar != null) { + mNavigationBar.setChecked(navigationBarEnabled); + } + + if (mButtonBrightness != null) { + mButtonBrightness.setChecked(buttonBrightnessEnabled); + } + + final PreferenceScreen prefScreen = getPreferenceScreen(); + + final PreferenceCategory homeCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_HOME); + + final PreferenceCategory backCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_BACK); + + final PreferenceCategory menuCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_MENU); + + final PreferenceCategory assistCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_ASSIST); + + final PreferenceCategory appSwitchCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_APP_SWITCH); + + final PreferenceCategory cameraCategory = + (PreferenceCategory) prefScreen.findPreference(KEY_CATEGORY_CAMERA); + + if (mDeviceHardwareKeys != 0 && mButtonBrightness != null) { + mButtonBrightness.setEnabled(!navigationBarEnabled); + } else if (mDeviceHardwareKeys == 0 && mButtonBrightness != null) { + prefScreen.removePreference(mButtonBrightness); + } + + if (hasHome && homeCategory != null) { + homeCategory.setEnabled(!navigationBarEnabled); + } else if (!hasHome && homeCategory != null) { + prefScreen.removePreference(homeCategory); + } + + if (hasBack && backCategory != null) { + backCategory.setEnabled(!navigationBarEnabled); + } else if (!hasBack && backCategory != null) { + prefScreen.removePreference(backCategory); + } + + if (hasMenu && menuCategory != null) { + menuCategory.setEnabled(!navigationBarEnabled); + } else if (!hasMenu && menuCategory != null) { + prefScreen.removePreference(menuCategory); + } + + if (hasAssist && assistCategory != null) { + assistCategory.setEnabled(!navigationBarEnabled); + } else if (!hasAssist && assistCategory != null) { + prefScreen.removePreference(assistCategory); + } + + if (hasAppSwitch && appSwitchCategory != null) { + appSwitchCategory.setEnabled(!navigationBarEnabled); + } else if (!hasAppSwitch && appSwitchCategory != null) { + prefScreen.removePreference(appSwitchCategory); + } + + if (hasCamera && cameraCategory != null) { + cameraCategory.setEnabled(true /*!navigationBarEnabled*/); + } else if (!hasCamera && cameraCategory != null) { + prefScreen.removePreference(cameraCategory); + } + } + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + final boolean handled = handleOnPreferenceChange(preference, newValue); + if (handled) { + reload(); + } + return handled; + } + + @Override + public boolean onPreferenceTreeClick(Preference preference) { + final boolean handled = handleOnPreferenceTreeClick(preference); + // return super.onPreferenceTreeClick(preferenceScreen, preference); + return handled; + } + + /** + * For Search. + */ + public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider() { + @Override + public List getXmlResourcesToIndex( + Context context, boolean enabled) { + SearchIndexableResource sir = new SearchIndexableResource(context); + sir.xmlResId = R.xml.buttons_settings; + return Arrays.asList(sir); + } + + @Override + public List getNonIndexableKeys(Context context) { + final ArrayList result = new ArrayList(); + + final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); + final int myUserId = UserHandle.myUserId(); + final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; + + // TODO: Implement search index provider. + + return result; + } + }; +} diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 88a3148154..75598cb4ca 100755 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -167,4 +167,6 @@ public static class WirelessSettings extends SettingsActivity { /* empty */ } public static class DeviceSettings extends SettingsActivity { /* empty */ } public static class PersonalSettings extends SettingsActivity { /* empty */ } public static class SystemSettings extends SettingsActivity { /* empty */ } + + public static class ButtonsSettingsActivity extends SettingsActivity { /* empty */ } } diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index aeca8b0eac..4d25158076 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -262,6 +262,7 @@ public class SettingsActivity extends SettingsDrawerActivity Settings.Lte4GEnableActivity.class.getName(), Settings.WirelessSettingsActivity.class.getName(), //device_section + Settings.ButtonsSettingsActivity.class.getName(), Settings.HomeSettingsActivity.class.getName(), Settings.SoundSettingsActivity.class.getName(), Settings.DisplaySettingsActivity.class.getName(), @@ -384,7 +385,8 @@ public class SettingsActivity extends SettingsDrawerActivity MasterClear.class.getName(), NightDisplaySettings.class.getName(), ManageDomainUrls.class.getName(), - AutomaticStorageManagerSettings.class.getName() + AutomaticStorageManagerSettings.class.getName(), + ButtonsSettings.class.getName() }; diff --git a/src/com/android/settings/search/Ranking.java b/src/com/android/settings/search/Ranking.java index 2137bd545a..cb131f15b5 100644 --- a/src/com/android/settings/search/Ranking.java +++ b/src/com/android/settings/search/Ranking.java @@ -16,6 +16,7 @@ package com.android.settings.search; +import com.android.settings.ButtonsSettings; import com.android.settings.ChooseLockGeneric; import com.android.settings.DateTimeSettings; import com.android.settings.DevelopmentSettings; @@ -87,6 +88,7 @@ public final class Ranking { public static final int RANK_DEVELOPEMENT = 22; public static final int RANK_DEVICE_INFO = 23; public static final int RANK_GESTURE = 24; + public static final int RANK_BUTTONS = 25; public static final int RANK_UNDEFINED = -1; public static final int RANK_OTHERS = 1024; @@ -185,6 +187,9 @@ public final class Ranking { sRankMap.put(DeviceInfoSettings.class.getName(), RANK_DEVICE_INFO); sRankMap.put(LegalSettings.class.getName(), RANK_DEVICE_INFO); + // Buttons + sRankMap.put(ButtonsSettings.class.getName(), RANK_BUTTONS); + sBaseRankMap.put("com.android.settings", 0); } diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java index 5332d99868..064ce9996b 100644 --- a/src/com/android/settings/search/SearchIndexableResources.java +++ b/src/com/android/settings/search/SearchIndexableResources.java @@ -17,6 +17,8 @@ package com.android.settings.search; import android.provider.SearchIndexableResource; + +import com.android.settings.ButtonsSettings; import com.android.settings.DateTimeSettings; import com.android.settings.DevelopmentSettings; import com.android.settings.DeviceInfoSettings; @@ -326,6 +328,13 @@ public final class SearchIndexableResources { R.xml.zen_mode_visual_interruptions_settings, ZenModeVisualInterruptionSettings.class.getName(), R.drawable.ic_settings_notifications)); + + sResMap.put(ButtonsSettings.class.getName(), + new SearchIndexableResource( + Ranking.getRankForClassName(ButtonsSettings.class.getName()), + R.xml.buttons_settings, + ButtonsSettings.class.getName(), + R.drawable.ic_settings_buttons)); } private SearchIndexableResources() { From 2af3033faad1745fac7f480d2858ca5ecf61a138 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar Date: Sun, 18 Sep 2016 10:12:05 +0700 Subject: [PATCH 27/37] Settings: Expose dashboard category and tile color Change-Id: Ia9c83eb9b8360923ed52e03641b4179681a80330 --- res/drawable/dashboard_category_title_bg.xml | 21 ++++++++++++++++++++ res/drawable/dashboard_tile_bg.xml | 21 ++++++++++++++++++++ res/drawable/selectable_card.xml | 4 ++-- res/layout/dashboard_category.xml | 2 +- res/values/projekt_colors.xml | 21 ++++++++++++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 res/drawable/dashboard_category_title_bg.xml create mode 100644 res/drawable/dashboard_tile_bg.xml create mode 100644 res/values/projekt_colors.xml diff --git a/res/drawable/dashboard_category_title_bg.xml b/res/drawable/dashboard_category_title_bg.xml new file mode 100644 index 0000000000..0e9604d838 --- /dev/null +++ b/res/drawable/dashboard_category_title_bg.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/res/drawable/dashboard_tile_bg.xml b/res/drawable/dashboard_tile_bg.xml new file mode 100644 index 0000000000..61d113d645 --- /dev/null +++ b/res/drawable/dashboard_tile_bg.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/res/drawable/selectable_card.xml b/res/drawable/selectable_card.xml index df9ddb1367..74018b214b 100644 --- a/res/drawable/selectable_card.xml +++ b/res/drawable/selectable_card.xml @@ -18,5 +18,5 @@ - - \ No newline at end of file + + diff --git a/res/layout/dashboard_category.xml b/res/layout/dashboard_category.xml index 2e5dd5ce06..7836644806 100644 --- a/res/layout/dashboard_category.xml +++ b/res/layout/dashboard_category.xml @@ -20,7 +20,7 @@ android:layout_height="@dimen/dashboard_category_height" android:orientation="vertical" android:paddingBottom="8dip" - android:background="@color/card_background"> + android:background="@drawable/dashboard_category_title_bg"> + + + + @color/card_background + @color/card_background + From f458083feef290fec1dd44b53eb5e8457559baaa Mon Sep 17 00:00:00 2001 From: daveyannihilation Date: Tue, 20 Sep 2016 23:35:04 +0800 Subject: [PATCH 28/37] Settings: Expose condition card colors PS2 Change to the actual colors in fwb that these attrs call to. @nathanchance edit: updated for Nougat 7.1 Change-Id: I8de2e2a4f79a28c0fe1f025b4d23937931fe293a --- res/layout/condition_card.xml | 18 +++++++++--------- res/values/projekt_colors.xml | 9 +++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/res/layout/condition_card.xml b/res/layout/condition_card.xml index 7c9e46da00..88277c2510 100644 --- a/res/layout/condition_card.xml +++ b/res/layout/condition_card.xml @@ -1,6 +1,6 @@ + android:background="@color/condition_card_divider_color" />