From 547c65731d325d651cc0088207741026f9b411c7 Mon Sep 17 00:00:00 2001 From: Harry Youd Date: Fri, 13 Sep 2019 03:23:34 -0400 Subject: [PATCH 001/265] Settings: Add DerpFest Version to FirmwareVersion Change-Id: I4acf834442712954f8e9db15370bffafd4547174 --- res/values-de/derp_strings.xml | 12 ++ res/values/derp_strings.xml | 12 ++ res/xml/firmware_version.xml | 8 ++ .../DerpFestVersionPreferenceController.java | 127 ++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 res/values-de/derp_strings.xml create mode 100644 res/values/derp_strings.xml create mode 100644 src/com/android/settings/deviceinfo/firmwareversion/DerpFestVersionPreferenceController.java diff --git a/res/values-de/derp_strings.xml b/res/values-de/derp_strings.xml new file mode 100644 index 00000000000..86deeae2dde --- /dev/null +++ b/res/values-de/derp_strings.xml @@ -0,0 +1,12 @@ + + + + + + DerpFest-Version + Unbekannt + + diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml new file mode 100644 index 00000000000..5eddd33cf8c --- /dev/null +++ b/res/values/derp_strings.xml @@ -0,0 +1,12 @@ + + + + + + DerpFest version + Unknown + + diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index 41f7733cfb2..b3fc2310707 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -30,6 +30,14 @@ settings:searchable="false" settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDetailPreferenceController"/> + + + = (SystemClock.uptimeMillis() - DELAY_TIMER_MILLIS)) { + if (mUserManager.hasUserRestriction(UserManager.DISALLOW_FUN)) { + if (mFunDisallowedAdmin != null && !mFunDisallowedBySystem) { + RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, + mFunDisallowedAdmin); + } + Log.d(TAG, "Sorry, no fun for you!"); + return true; + } + + final Intent intent = new Intent(Intent.ACTION_MAIN) + .setClassName( + "android", com.android.internal.app.PlatLogoActivity.class.getName()); + try { + mContext.startActivity(intent); + } catch (Exception e) { + Log.e(TAG, "Unable to start activity " + intent.toString()); + } + } + return true; + } + + /** + * Copies the array onto itself to remove the oldest hit. + */ + @VisibleForTesting + void arrayCopy() { + System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1); + } + + @VisibleForTesting + void initializeAdminPermissions() { + mFunDisallowedAdmin = RestrictedLockUtilsInternal.checkIfRestrictionEnforced( + mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId()); + mFunDisallowedBySystem = RestrictedLockUtilsInternal.hasBaseUserRestriction( + mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId()); + } +} From a01d0c20c492fd7a90410cb934fe4ef3241d4a77 Mon Sep 17 00:00:00 2001 From: Harsh Pal Date: Fri, 29 Oct 2021 20:27:43 +0000 Subject: [PATCH 002/265] Settings: Unlink android version from toolbar * thanks to mukul sir for pointing out * https://imgur.com/ouLN6JB * under Android Version --> Platform 12 understandable instead of android version inside android version. Change-Id: I41ba6e5ef556b23f50d9b65260403f1b771f98c3 --- res/values-de/derp_strings.xml | 3 +++ res/values/derp_strings.xml | 3 +++ res/xml/firmware_version.xml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/res/values-de/derp_strings.xml b/res/values-de/derp_strings.xml index 86deeae2dde..12b6dae7375 100644 --- a/res/values-de/derp_strings.xml +++ b/res/values-de/derp_strings.xml @@ -9,4 +9,7 @@ DerpFest-Version Unbekannt + + Plattform-Version + diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index 5eddd33cf8c..482189c67ea 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -9,4 +9,7 @@ DerpFest version Unknown + + Platform version + diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index b3fc2310707..e2106c41f1e 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -24,7 +24,7 @@ Date: Mon, 9 Sep 2019 20:07:42 +0200 Subject: [PATCH 003/265] Settings: Add DerpFest logo inside firmware version * vector drawable made by rushier5T @ Telegram Co-authored-by: Ido Ben-Hur Co-authored-by: Hanif Ardhani Change-Id: I004794ce2610164b14087857343986c81f22de82 Signed-off-by: NurKeinNeid --- res/drawable-night/ic_derp_logo.xml | 34 +++++++++++++++++++++++++++++ res/drawable/ic_derp_logo.xml | 34 +++++++++++++++++++++++++++++ res/layout/derp_logo.xml | 20 +++++++++++++++++ res/xml/firmware_version.xml | 6 +++++ 4 files changed, 94 insertions(+) create mode 100644 res/drawable-night/ic_derp_logo.xml create mode 100644 res/drawable/ic_derp_logo.xml create mode 100644 res/layout/derp_logo.xml diff --git a/res/drawable-night/ic_derp_logo.xml b/res/drawable-night/ic_derp_logo.xml new file mode 100644 index 00000000000..bf85db7327d --- /dev/null +++ b/res/drawable-night/ic_derp_logo.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/res/drawable/ic_derp_logo.xml b/res/drawable/ic_derp_logo.xml new file mode 100644 index 00000000000..1a91883c976 --- /dev/null +++ b/res/drawable/ic_derp_logo.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/res/layout/derp_logo.xml b/res/layout/derp_logo.xml new file mode 100644 index 00000000000..70413bd52a0 --- /dev/null +++ b/res/layout/derp_logo.xml @@ -0,0 +1,20 @@ + + + + + + + diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index e2106c41f1e..93455727bd2 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -21,6 +21,12 @@ android:title="@string/firmware_version" settings:keywords="@string/keywords_android_version"> + + + Date: Thu, 19 Mar 2020 14:18:05 +0000 Subject: [PATCH 004/265] Settings: Add ROM banner uri link Change-Id: Id391f779c3ac43de5a1bf6848f5cbd27591fa9a3 --- res/xml/firmware_version.xml | 3 +- .../DerpFestLogoPreferenceController.java | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/com/android/settings/deviceinfo/firmwareversion/DerpFestLogoPreferenceController.java diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index 93455727bd2..6b25d95835c 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -25,7 +25,8 @@ + android:clickable="true" + settings:controller="com.android.settings.deviceinfo.firmwareversion.DerpFestLogoPreferenceController"/> Date: Tue, 3 Apr 2018 14:00:00 +0100 Subject: [PATCH 005/265] Settings: Add simple maintainer string * No need to use a build.prop for this and overlaying from DT will be easier for maintainers this way Change-Id: Ibc9fa6ba521e9e27a46a73349cbb87c0bd1b6e9f Signed-off-by: NurKeinNeid --- res/values-de/derp_strings.xml | 3 +++ res/values/derp_strings.xml | 4 ++++ res/xml/firmware_version.xml | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/res/values-de/derp_strings.xml b/res/values-de/derp_strings.xml index 12b6dae7375..3e397e19f39 100644 --- a/res/values-de/derp_strings.xml +++ b/res/values-de/derp_strings.xml @@ -12,4 +12,7 @@ Plattform-Version + + Entwickler + diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index 482189c67ea..2e834a4936c 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -12,4 +12,8 @@ Platform version + + Maintainer + Unknown + diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index 6b25d95835c..6310c0aed6b 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -45,6 +45,13 @@ settings:enableCopying="true" settings:controller="com.android.settings.deviceinfo.firmwareversion.DerpFestVersionPreferenceController"/> + + + Date: Sat, 15 Feb 2020 18:04:16 +0300 Subject: [PATCH 006/265] Settings: Add support to open device maintainer's telegram * Do this by overlaying on top of in derp_strings.xml Change-Id: I3bcd5292e1a03028262fbfa38bc2b7a8bb8a3967 Signed-off-by: NurKeinNeid --- res/values/derp_strings.xml | 1 + res/xml/firmware_version.xml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index 2e834a4936c..5ae33acccb7 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -15,5 +15,6 @@ Maintainer Unknown + https://t.me/DerpFest5T diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml index 6310c0aed6b..82de098d11b 100644 --- a/res/xml/firmware_version.xml +++ b/res/xml/firmware_version.xml @@ -50,7 +50,11 @@ android:key="maintainer" android:title="@string/maintainer" android:summary="@string/maintainer_name" - settings:enableCopying="true" /> + settings:enableCopying="true" > + + Date: Sun, 22 Aug 2021 06:53:40 -0700 Subject: [PATCH 007/265] Settings: Hardcode mainline module provider to google * We don't want the preference to show at all if partner modules aren't present, its useless to show since it will always match platform. * Privacy oriented users who haven't installed GMS also don't seem to like seeing "Google" mentioned in Settings. Change-Id: If20554216175a71dcc55f5cebf41c46ce752a19c Signed-off-by: Adithya R --- .../MainlineModuleVersionPreferenceController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java index 4c02feb044f..4171a9c4fea 100644 --- a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java +++ b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java @@ -74,8 +74,7 @@ public int getAvailabilityStatus() { } private void initModules() { - final String moduleProvider = mContext.getString( - com.android.internal.R.string.config_defaultModuleMetadataProvider); + final String moduleProvider = "com.google.android.modulemetadata"; if (!TextUtils.isEmpty(moduleProvider)) { try { mModuleVersion = From 8e53a9f18d9ab8078ad5851b26d3d6803b85cf9b Mon Sep 17 00:00:00 2001 From: Adithya R Date: Tue, 12 Oct 2021 11:16:56 +0530 Subject: [PATCH 008/265] Settings: Display auto rotate settings instead of toggle * allows to enable auto rotate face detection Change-Id: I6d3582063ab48d7de60d35a14cbb87421e3b72fb --- res/xml/display_settings.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index 4e52cf49092..30dded5cbd1 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -129,11 +129,12 @@ Standard auto-rotation preference that will be shown when device state based auto-rotation settings are NOT available. --> - + settings:controller="com.android.settings.display.SmartAutoRotatePreferenceController"/> Entwickler + + Bildschirmausrichtung + Automatische Bildschirmausrichtung aktiviert + Automatische Bildschirmausrichtung deaktiviert + Grad + Bildschirmausrichtung bei + 0 Grad + 90 Grad + 180 Grad + 270 Grad diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index 5ae33acccb7..4239163e2fd 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -17,4 +17,14 @@ Unknown https://t.me/DerpFest5T + + Rotation settings + Auto-rotation is enabled + Auto-rotation is disabled + degrees + Rotation modes + 0 degrees + 90 degrees + 180 degrees + 270 degrees diff --git a/res/xml/auto_rotate_settings.xml b/res/xml/auto_rotate_settings.xml index e8303b14cdd..6900f34a23e 100644 --- a/res/xml/auto_rotate_settings.xml +++ b/res/xml/auto_rotate_settings.xml @@ -55,6 +55,31 @@ android:title="@string/auto_rotate_switch_face_based" settings:controller="com.android.settings.display.SmartAutoRotateController" /> + + + + + + + + + + + - - - - + settings:controller="com.android.settings.display.SmartAutoRotatePreferenceController" + settings:keywords="@string/keywords_auto_rotate" /> Date: Wed, 15 Aug 2012 20:19:22 -0400 Subject: [PATCH 010/265] Settings: Add lockscreen rotation as an optional rotation setting This will allow the user to select wether or not to use the rotation settings for the lockscreen. This is dependent upon the rotation setting being checked. Change-Id: If45c13a395e0d71b7c4cdcf484a6b8cef964ee37 Signed-off-by: koron393 --- res/values-de/derp_strings.xml | 1 + res/values/derp_strings.xml | 1 + res/xml/auto_rotate_settings.xml | 5 +++++ .../SmartAutoRotatePreferenceFragment.java | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/res/values-de/derp_strings.xml b/res/values-de/derp_strings.xml index 06f7610b000..023a10b85ca 100644 --- a/res/values-de/derp_strings.xml +++ b/res/values-de/derp_strings.xml @@ -19,6 +19,7 @@ Bildschirmausrichtung Automatische Bildschirmausrichtung aktiviert Automatische Bildschirmausrichtung deaktiviert + Sperrbildschirm Grad Bildschirmausrichtung bei 0 Grad diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index 4239163e2fd..f63c80c4621 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -21,6 +21,7 @@ Rotation settings Auto-rotation is enabled Auto-rotation is disabled + Lock screen degrees Rotation modes 0 degrees diff --git a/res/xml/auto_rotate_settings.xml b/res/xml/auto_rotate_settings.xml index 6900f34a23e..8cc66caf837 100644 --- a/res/xml/auto_rotate_settings.xml +++ b/res/xml/auto_rotate_settings.xml @@ -55,6 +55,11 @@ android:title="@string/auto_rotate_switch_face_based" settings:controller="com.android.settings.display.SmartAutoRotateController" /> + + diff --git a/src/com/android/settings/display/SmartAutoRotatePreferenceFragment.java b/src/com/android/settings/display/SmartAutoRotatePreferenceFragment.java index a38fb07fdfb..551d95b3b53 100644 --- a/src/com/android/settings/display/SmartAutoRotatePreferenceFragment.java +++ b/src/com/android/settings/display/SmartAutoRotatePreferenceFragment.java @@ -59,12 +59,13 @@ public class SmartAutoRotatePreferenceFragment extends DashboardFragment { static final String AUTO_ROTATE_SWITCH_PREFERENCE_KEY = "auto_rotate_switch"; private static final String KEY_FOOTER_PREFERENCE = "auto_rotate_footer_preference"; - + private static final String LOCKSCREEN_ROTATION = "lockscreen_rotation"; private static final String ROTATION_0_PREF = "display_rotation_0"; private static final String ROTATION_90_PREF = "display_rotation_90"; private static final String ROTATION_180_PREF = "display_rotation_180"; private static final String ROTATION_270_PREF = "display_rotation_270"; + private SwitchPreference mLockScreenRotationPref; private SwitchPreference mRotation0Pref; private SwitchPreference mRotation90Pref; private SwitchPreference mRotation180Pref; @@ -106,6 +107,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, setupFooter(); } + mLockScreenRotationPref = findPreference(LOCKSCREEN_ROTATION); mRotation0Pref = findPreference(ROTATION_0_PREF); mRotation90Pref = findPreference(ROTATION_90_PREF); mRotation180Pref = findPreference(ROTATION_180_PREF); @@ -115,6 +117,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Settings.System.ACCELEROMETER_ROTATION_ANGLES, ROTATION_0_MODE|ROTATION_90_MODE|ROTATION_270_MODE, UserHandle.USER_CURRENT); + boolean configEnableLockRotation = getResources(). + getBoolean(com.android.internal.R.bool.config_enableLockScreenRotation); + boolean lockScreenRotationEnabled = Settings.System.getInt(getContentResolver(), + Settings.System.LOCKSCREEN_ROTATION, configEnableLockRotation ? 1 : 0) != 0; + + mLockScreenRotationPref.setChecked(lockScreenRotationEnabled); mRotation0Pref.setChecked((mode & ROTATION_0_MODE) != 0); mRotation90Pref.setChecked((mode & ROTATION_90_MODE) != 0); mRotation180Pref.setChecked((mode & ROTATION_180_MODE) != 0); @@ -193,6 +201,11 @@ public boolean onPreferenceTreeClick(Preference preference) { Settings.System.putIntForUser(getActivity().getApplicationContext().getContentResolver(), Settings.System.ACCELEROMETER_ROTATION_ANGLES, mode, UserHandle.USER_CURRENT); return true; + } else if (preference == mLockScreenRotationPref) { + Settings.System.putInt(getContentResolver(), + Settings.System.LOCKSCREEN_ROTATION, + mLockScreenRotationPref.isChecked() ? 1 : 0); + return true; } return super.onPreferenceTreeClick(preference); } From f1dbadd3f36c8c1d1ddf53686451f8fe6d4f63a3 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Fri, 24 Apr 2020 22:22:47 +0100 Subject: [PATCH 011/265] BasebandVersionPreferenceController: Trim baseband if needed Some Qualcomm MSIM devices report the baseband version twice. Handle it gracefully, similarly to CAF. Change-Id: I93bd071f31fed120c20185c4e0ec40edb7ca342b --- .../BasebandVersionPreferenceController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java index dd3d560282a..a81993b2e64 100644 --- a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java +++ b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java @@ -18,6 +18,7 @@ import android.content.Context; import android.os.SystemProperties; +import android.text.TextUtils; import androidx.annotation.VisibleForTesting; @@ -41,7 +42,13 @@ public int getAvailabilityStatus() { @Override public CharSequence getSummary() { - return SystemProperties.get(BASEBAND_PROPERTY, + String baseband = SystemProperties.get(BASEBAND_PROPERTY, mContext.getString(R.string.device_info_default)); + for (String str : baseband.split(",")) { + if (!TextUtils.isEmpty(str)) { + return str; + } + } + return baseband; } } From 6aee7df69bb2df796195fd83de7b46c761f10d41 Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Sat, 2 Nov 2019 23:09:40 +0100 Subject: [PATCH 012/265] Add toggle to enable ADB root Author: dianlujitao Date: Sun Nov 24 14:33:05 2019 +0800 Settings: Mark adb root toggle as non-persistent * It's always read from the binder API Change-Id: I88234450a2dcfbea985eb3c48114d869db331cd0 Author: dianlujitao Date: Sun Nov 24 14:34:51 2019 +0800 Settings: Remove ADBROOT permission from manifest Change-Id: I2a458cda22b3d370734adb89ff8e0303ca1c8374 Author: Luca Stefani Date: Fri Mar 13 23:05:25 2020 +0100 Hide ADB Root preference on user builds Change-Id: I8c9251ddda0eb15e1134d4fafbf3d972f5fa8809 Author: LuK1337 Date: Thu Mar 24 09:06:33 2022 +0100 AdbRootPreferenceController: Use ADBRootService::isSupported() This allows us to show the preference in Settings even if Build.IS_DEBUGGABLE is false. Change-Id: I28f8a0fefc7b611ce7433de3dae5579abdb73274 Change-Id: Ic80dbf79265c0fe7113f42299479873befb05004 --- res/values-de/derp_strings.xml | 3 + res/values/derp_strings.xml | 3 + res/xml/development_settings.xml | 7 ++ .../AdbRootPreferenceController.java | 84 +++++++++++++++++++ .../DevelopmentSettingsDashboardFragment.java | 1 + 5 files changed, 98 insertions(+) create mode 100644 src/com/android/settings/development/AdbRootPreferenceController.java diff --git a/res/values-de/derp_strings.xml b/res/values-de/derp_strings.xml index 023a10b85ca..d62b2f4ab78 100644 --- a/res/values-de/derp_strings.xml +++ b/res/values-de/derp_strings.xml @@ -4,6 +4,9 @@ SPDX-License-Identifier: Apache-2.0 --> + + Root-Debugging + Android-Debugging als Root erlauben DerpFest-Version diff --git a/res/values/derp_strings.xml b/res/values/derp_strings.xml index f63c80c4621..c075ffebd76 100644 --- a/res/values/derp_strings.xml +++ b/res/values/derp_strings.xml @@ -4,6 +4,9 @@ SPDX-License-Identifier: Apache-2.0 --> + + Rooted debugging + Allow running Android debugging as root DerpFest version diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index 866a529dd8b..a9a92a3b0b3 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -179,6 +179,13 @@ android:title="@string/enable_adb" android:summary="@string/enable_adb_summary" /> + + diff --git a/src/com/android/settings/development/AdbRootPreferenceController.java b/src/com/android/settings/development/AdbRootPreferenceController.java new file mode 100644 index 00000000000..41e2d0b8095 --- /dev/null +++ b/src/com/android/settings/development/AdbRootPreferenceController.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2018 The LineageOS 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.development; + +import android.adb.ADBRootService; +import android.content.Context; +import android.os.UserManager; + +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; +import androidx.preference.SwitchPreferenceCompat; + +import com.android.settings.R; +import com.android.settings.core.PreferenceControllerMixin; +import com.android.settingslib.development.DeveloperOptionsPreferenceController; + +public class AdbRootPreferenceController extends DeveloperOptionsPreferenceController + implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin { + + private static final String TAG = "AdbRootPreferenceController"; + private static final String PREF_KEY = "enable_adb_root"; + + private final ADBRootService mADBRootService; + + public AdbRootPreferenceController(Context context, + DevelopmentSettingsDashboardFragment fragment) { + super(context); + + mADBRootService = new ADBRootService(); + } + + @Override + public String getPreferenceKey() { + return PREF_KEY; + } + + @Override + public boolean isAvailable() { + return mADBRootService.isSupported(); + } + + @Override + public void displayPreference(PreferenceScreen screen) { + super.displayPreference(screen); + + ((SwitchPreferenceCompat) mPreference).setChecked(mADBRootService.getEnabled()); + + if (!isAdminUser()) { + mPreference.setEnabled(false); + } + } + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + final boolean rootEnabled = (Boolean) newValue; + mADBRootService.setEnabled(rootEnabled); + return true; + } + + @Override + protected void onDeveloperOptionsSwitchEnabled() { + if (isAdminUser()) { + mPreference.setEnabled(true); + } + } + + boolean isAdminUser() { + return ((UserManager) mContext.getSystemService(Context.USER_SERVICE)).isAdminUser(); + } +} diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java index 38cb6c72e96..e4ff7431794 100644 --- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java +++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java @@ -673,6 +673,7 @@ private static List buildPreferenceControllers(Con controllers.add(new DisableAutomaticUpdatesPreferenceController(context)); controllers.add(new SelectDSUPreferenceController(context)); controllers.add(new AdbPreferenceController(context, fragment)); + controllers.add(new AdbRootPreferenceController(context, fragment)); controllers.add(new ClearAdbKeysPreferenceController(context, fragment)); controllers.add(new WirelessDebuggingPreferenceController(context, lifecycle)); controllers.add(new AdbAuthorizationTimeoutPreferenceController(context)); From 347399caed1103677bd7f37289365b3b9caa21d3 Mon Sep 17 00:00:00 2001 From: Alex Cruz Date: Fri, 17 Nov 2017 17:50:29 -0500 Subject: [PATCH 013/265] Developer options toast insulter Inspired by the Bash insulter written by hkbakke https://www.ostechnix.com/bash-insulter-script-insults-user-typing-wrong-command/ Change-Id: I48d52de431de1eedf7a965a83a7dcb464ef3ed3a Signed-off-by: SagarMakhar --- .../BuildNumberPreferenceController.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java index 6fe3ca4521b..29d000302b1 100644 --- a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java +++ b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java @@ -50,6 +50,8 @@ import com.google.android.setupcompat.util.WizardManagerHelper; +import java.util.Random; + public class BuildNumberPreferenceController extends BasePreferenceController implements LifecycleObserver, OnStart { @@ -67,6 +69,29 @@ public class BuildNumberPreferenceController extends BasePreferenceController im private int mDevHitCountdown; private boolean mProcessingLastDevHit; + public final static java.lang.String[] insults = { + "Hahaha, n00b!", + "What are you doing??", + "n00b alert!", + "What is this...? Amateur hour!?", + "This is not Windows", + "Please step away from the device!", + "error code: 1D10T", + "Go outside", + "¯\\_(ツ)_/¯", + "Pro tip: Stop doing this!", + "Y u no speak computer???", + "Why are you so stupid?!", + "Perhaps this Android thing is not for you...", + "Don't you have anything better to do?!", + "This is why nobody likes you...", + "Are you even trying?!", + "Looks like you're derping... BUT THATS OUR BUSINESS!!!", + "This won't make you look cooler to your friends", + "Go back to your stock ROM", + "You look like a person who plays PUBG on his phone", + }; + public BuildNumberPreferenceController(Context context, String key) { super(context, key); mUm = (UserManager) context.getSystemService(Context.USER_SERVICE); @@ -198,7 +223,9 @@ public boolean handlePreferenceTreeClick(Preference preference) { if (mDevHitToast != null) { mDevHitToast.cancel(); } - mDevHitToast = Toast.makeText(mContext, R.string.show_dev_already, + Random randomInsult = new Random(); + final int toasts = randomInsult.nextInt(insults.length); + mDevHitToast = Toast.makeText(mContext, insults[toasts], Toast.LENGTH_LONG); mDevHitToast.show(); mMetricsFeatureProvider.action( From 42f465772702ec8296d02c21af0d897c587b04d2 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Thu, 5 May 2022 01:38:53 +0300 Subject: [PATCH 014/265] Don't reset A2DP offload when disabling developer settings * We need to disable A2DP HW offload on FP4 for now, however disabling developer settings would enable offload again and break SBC and AAC audio. Just remove this section and allow this setting to persist after disabling developer settings. Change-Id: I5b65b3887d68ac684d7ea78de0ee89fb7db9bb0f --- ...oothA2dpHwOffloadPreferenceController.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/com/android/settings/development/BluetoothA2dpHwOffloadPreferenceController.java b/src/com/android/settings/development/BluetoothA2dpHwOffloadPreferenceController.java index f460b9e33fe..7d4b7a6fdda 100644 --- a/src/com/android/settings/development/BluetoothA2dpHwOffloadPreferenceController.java +++ b/src/com/android/settings/development/BluetoothA2dpHwOffloadPreferenceController.java @@ -74,23 +74,10 @@ public void updateState(Preference preference) { } } - @Override - protected void onDeveloperOptionsSwitchDisabled() { - super.onDeveloperOptionsSwitchDisabled(); - final boolean offloadSupported = - SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false); - if (offloadSupported) { - ((TwoStatePreference) mPreference).setChecked(false); - SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false"); - } - } - public boolean isDefaultValue() { - final boolean offloadSupported = - SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false); - final boolean offloadDisabled = - SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false); - return offloadSupported ? !offloadDisabled : true; + // Always return true here to avoid needing to reboot when disabling + // developer options, since we aren't turning this off when doing so anymore. + return true; } /** From 4f15e02cdb2d28b572f12846e56dc954c25760db Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Fri, 1 Aug 2014 18:34:15 +0300 Subject: [PATCH 015/265] Settings: Fix the failing strings Having double quotes around the strings causes crowdin to export translations with unescaped quotes. Removing them has no side effect and fixes crowdin export. Change-Id: I93865d793eef711f8738e00e843e9d4670724c66 --- res/values/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f92fd2aca84..18efc94b3bb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3500,11 +3500,11 @@ Erase all data (factory reset) - "
  • Music
  • \n
  • Photos
  • \n
  • Other user data
  • "
    +
  • Music
  • \n
  • Photos
  • \n
  • Other user data
  • - "
  • eSIMs
  • "
    +
  • eSIMs
  • - "\n\nThis will not cancel your mobile service plan. + \n\nThis will not cancel your mobile service plan. All of your personal information and downloaded apps will be deleted. You can\u2019t undo this action. From 4fc56e0cc7283f3faebc7c94975dbc51dd34d99f Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Thu, 12 Dec 2013 05:40:54 +0200 Subject: [PATCH 016/265] Settings: Forward port lock pattern grid size (2/2) Author: d34d Date: Tue Dec 29 11:51:21 2015 -0800 Fingerprint: Forward challenge extras The forward port of custom pattern sizes introduced a bug that would cause an NPE when trying to add a fingerprint for security. This patch forwards the extras associated with the challenge that would have normally been passed directly in to the ChooseLockPattern fragment. Change-Id: I3ad994b2604ff45b573c011c3588afe8b35bfdd3 TICKET: CYNGNOS-1490 Author: Roman Birg Date: Mon Mar 21 15:17:16 2016 -0700 Settings: forward decrypt required on boot flag This wasn't being pass forward and all of the defaults had it set to true. Ticket: CYNGNOS-2270 Change-Id: I90a6c918bb5b4b52791bcff18a6ea3bcfb194547 Signed-off-by: Roman Birg Author: Roman Birg Date: Fri Dec 11 11:37:00 2015 -0600 Settings: allow rotation while setting new pattern Change-Id: I0fc9a7df686b8af0c60edf1916dc6fe02185f704 Signed-off-by: Roman Birg Author: Roman Birg Date: Mon Apr 6 12:20:33 2015 -0700 Settings: handle decrypting larger pattern sizes Change-Id: Id24d46829063171fa87cabb23a7da378726d7548 Signed-off-by: Roman Birg Author: Roman Birg Date: Tue Apr 28 14:02:21 2015 -0700 CryptKeeper: pattern unlock displays incorrect pw when correct fakeUnlockAttempt() gets called when the user inputs any pattern length < 4 which queues up the 'incorrect error' message. The message needs to be cleared before trying to actually check the password so it never goes through in case the password was correct. Change-Id: If78db332d3d696ba443d0be911fb5db504cb14cd Signed-off-by: Roman Birg Author: Roman Birg Date: Fri May 1 17:07:47 2015 -0700 Settings: fix non lock pattern CryptKeeper crash Change-Id: Ib2d6c9a468bfe778d5cb927759f11b2b03c25ee6 Signed-off-by: Roman Birg Author: Roman Birg Date: Tue May 19 14:06:51 2015 -0700 CryptKeeper: layout whole screen in bounds Add flags to make the screen layout properly on devices with the navigation bar visible Change-Id: I8607c8e49ac3625a7fb6a13b4501ea7ac818b9ba Signed-off-by: Roman Birg Author: Roman Birg Date: Wed May 20 10:31:13 2015 -0700 CryptKeeper improvements - Status text was used enough to warrant it being a field variable instead of looking for the view every time - Display proper text after changing pattern sizes (to input a pattern, not a password) - Disable changing pattern sizes while validaing pattern REFS: LETTUCE-557, LETTUCE-352 Change-Id: Ib4ecf04a58da8d1648d514d9650d69c33d9587a7 Signed-off-by: Roman Birg Author: Alberto97 Date: Mon Nov 21 20:47:25 2016 +0100 Settings: Use GLIF Theme for missing Settings > Screen lock Activities Icons by Asher Change-Id: Icf1627b41ef604302a5819ad3b1bdfd6d8479202 Author: LuK1337 Date: Mon May 10 22:00:01 2021 +0200 Settings: Remove hardcoded extras from ChooseLockPatternSize Change-Id: I860d87842de0dbb9f87394a0c1fc5043fd16b07b Author: LuK1337 Date: Tue May 11 11:32:38 2021 +0200 Settings: Make setup wizard go through ChooseLockPatternSize if needed Change-Id: Idfd3670d4b541b3618c4416b3b9dbf7d88ae3ed1 Author: LuK1337 Date: Mon May 10 22:29:49 2021 +0200 Settings: Make FRP go through ChooseLockPatternSize if needed Change-Id: I70b0ddb20033dd5505c391763a0a58fd2f9c8004 Change-Id: I7078d703c218cd096d9b77c003a94b52fbce6322 --- AndroidManifest.xml | 4 + res/drawable/ic_security_pattern_3x3.xml | 26 ++++ res/drawable/ic_security_pattern_4x4.xml | 26 ++++ res/drawable/ic_security_pattern_5x5.xml | 26 ++++ res/drawable/ic_security_pattern_6x6.xml | 26 ++++ res/layout/crypt_keeper_pattern_sizes.xml | 67 +++++++++ res/values-de/derp_strings.xml | 3 + res/values/derp_strings.xml | 7 + res/values/derp_styles.xml | 24 +++ res/xml/security_settings_pattern_size.xml | 44 ++++++ .../settings/password/ChooseLockPassword.java | 3 +- .../settings/password/ChooseLockPattern.java | 37 +++-- .../password/ChooseLockPatternSize.java | 141 ++++++++++++++++++ .../password/ChooseLockSettingsHelper.java | 7 +- .../password/ConfirmLockPassword.java | 3 +- .../settings/password/ConfirmLockPattern.java | 12 +- .../password/SaveAndFinishWorker.java | 9 +- .../password/SetupChooseLockPattern.java | 3 +- 18 files changed, 446 insertions(+), 22 deletions(-) create mode 100644 res/drawable/ic_security_pattern_3x3.xml create mode 100644 res/drawable/ic_security_pattern_4x4.xml create mode 100644 res/drawable/ic_security_pattern_5x5.xml create mode 100644 res/drawable/ic_security_pattern_6x6.xml create mode 100644 res/layout/crypt_keeper_pattern_sizes.xml create mode 100644 res/values/derp_styles.xml create mode 100644 res/xml/security_settings_pattern_size.xml create mode 100644 src/com/android/settings/password/ChooseLockPatternSize.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 69d000a9e89..d66713bcde6 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2916,6 +2916,10 @@ android:enableOnBackInvokedCallback="false" android:excludeFromRecents="true" /> + + + + + diff --git a/res/drawable/ic_security_pattern_4x4.xml b/res/drawable/ic_security_pattern_4x4.xml new file mode 100644 index 00000000000..92c580f5e2c --- /dev/null +++ b/res/drawable/ic_security_pattern_4x4.xml @@ -0,0 +1,26 @@ + + + + diff --git a/res/drawable/ic_security_pattern_5x5.xml b/res/drawable/ic_security_pattern_5x5.xml new file mode 100644 index 00000000000..7b4dabaad79 --- /dev/null +++ b/res/drawable/ic_security_pattern_5x5.xml @@ -0,0 +1,26 @@ + + + + diff --git a/res/drawable/ic_security_pattern_6x6.xml b/res/drawable/ic_security_pattern_6x6.xml new file mode 100644 index 00000000000..1861284dbbf --- /dev/null +++ b/res/drawable/ic_security_pattern_6x6.xml @@ -0,0 +1,26 @@ + + + + diff --git a/res/layout/crypt_keeper_pattern_sizes.xml b/res/layout/crypt_keeper_pattern_sizes.xml new file mode 100644 index 00000000000..adbbfa0db9e --- /dev/null +++ b/res/layout/crypt_keeper_pattern_sizes.xml @@ -0,0 +1,67 @@ + + + + +