From e44543ae2b3bb1c3a642124c8e5d2482c1b85b4d Mon Sep 17 00:00:00 2001 From: readone Date: Tue, 2 Dec 2014 01:56:37 +0700 Subject: [PATCH 1/5] Fix FC when trying to adjust radio band via *#*#4636#*#* dialer code --- src/com/android/settings/BandMode.java | 67 +++++++++++++++----------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/src/com/android/settings/BandMode.java b/src/com/android/settings/BandMode.java index 81e8b4987de..0056d800f49 100644 --- a/src/com/android/settings/BandMode.java +++ b/src/com/android/settings/BandMode.java @@ -20,30 +20,46 @@ /** * Radio Band Mode Selection Class - * - * It will query baseband about all available band modes and display them - * in screen. It will display all six band modes if the query failed. - * - * After user select one band, it will send the selection to baseband. - * - * It will alter user the result of select operation and exit, no matter success - * or not. - * - */ +/** +* Radio Band Mode Selection Class +* This will query the device for all available band modes +* and display the options on the screen. If however it fails it will then +* display all the available band modes that are in the BAND_NAMES array. +* After the user selects a band, it will attempt to set the band mode +* regardless of the outcome. However if the bandmode will not work RIL.Java +* will catch it and throw a GENERIC_FAILURE or RADIO_NOT_AVAILABLE error +*/ public class BandMode extends Activity { private static final String LOG_TAG = "phone"; private static final boolean DBG = false; private static final int EVENT_BAND_SCAN_COMPLETED = 100; private static final int EVENT_BAND_SELECTION_DONE = 200; - +/* +* pulled from hardware/ril/include/telephony/ril.h and cleaned up a little +* there ought to be a better way to do this... +* make queryAvailableBandMode return something other than just an int array? +*/ private static final String[] BAND_NAMES = new String[] { - "Automatic", - "EURO Band", - "USA Band", - "JAPAN Band", - "AUS Band", - "AUS2 Band" + "Automatic", + "EURO Band (GSM-900/DCS-1800/WCDMA-IMT-2000)", + "USA Band (GSM-850/PCS-1900/WCDMA-850/WCDMA-PCS-1900)", + "JAPAN Band (WCDMA-800/WCDMA-IMT-2000)", + "AUS Band (GSM-900/DCS-1800/WCDMA-850/WCDMA-IMT-2000)", + "AUS2 Band (GSM-900/DCS-1800/WCDMA-850)", + "Cellular (800-MHz)", + "PCS (1900-MHz)", + "Band Class 3 (JTACS Band)", + "Band Class 4 (Korean PCS Band)", + "Band Class 5 (450-MHz Band)", + "Band Class 6 (2-GMHz IMT2000 Band)", + "Band Class 7 (Upper 700-MHz Band)", + "Band Class 8 (1800-MHz Band)", + "Band Class 9 (900-MHz Band)", + "Band Class 10 (Secondary 800-MHz Band)", + "Band Class 11 (400-MHz European PAMR Band)", + "Band Class 15 (AWS Band)", + "Band Class 16 (US 2.5-GHz Band)" }; private ListView mBandList; @@ -140,21 +156,18 @@ private void bandListLoaded(AsyncResult result) { if (result.result != null) { int bands[] = (int[])result.result; - int size = bands[0]; - - if (size > 0) { - for (int i=1; i Date: Fri, 26 Dec 2014 22:41:53 +0700 Subject: [PATCH 2/5] Revert "[1/2] Settings: OmniGears: resurrection" --- Android.mk | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Android.mk b/Android.mk index 610a65092f3..be0aafba58c 100644 --- a/Android.mk +++ b/Android.mk @@ -10,17 +10,14 @@ LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ src/com/android/settings/EventLogTags.logtags LOCAL_SRC_FILES += $(call all-java-files-under, ../PerformanceControl/src) -LOCAL_SRC_FILES += $(call all-java-files-under, ../OmniGears/src) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_RESOURCE_DIR += packages/apps/PerformanceControl/res -LOCAL_RESOURCE_DIR += packages/apps/OmniGears/res LOCAL_ASSET_DIR += packages/apps/PerformanceControl/assets LOCAL_AAPT_FLAGS := --auto-add-overlay \ - --extra-packages com.brewcrewfoo.performance \ - --extra-packages org.omnirom.omnigears + --extra-packages com.brewcrewfoo.performance LOCAL_PACKAGE_NAME := Settings LOCAL_CERTIFICATE := platform From ae932097df0ea3a8f607b85112ea9efb0b232b66 Mon Sep 17 00:00:00 2001 From: readone Date: Wed, 21 Jan 2015 17:02:57 +0700 Subject: [PATCH 3/5] Switch to new Superuser --- Android.mk | 6 + AndroidManifest.xml | 69 +++++++++++ proguard.flags | 2 + res/values/enhancement_vars.xml | 9 ++ res/xml/dashboard_categories.xml | 8 ++ .../android/settings/HostnamePreference.java | 111 ++++++++++++++++++ .../settings/MultitaskSuRequestActivity.java | 4 + src/com/android/settings/NotifyActivity.java | 4 + .../settings/PolicyNativeFragment.java | 4 + src/com/android/settings/RequestActivity.java | 4 + src/com/android/settings/SuReceiver.java | 4 + 11 files changed, 225 insertions(+) create mode 100644 res/values/enhancement_vars.xml create mode 100644 src/com/android/settings/HostnamePreference.java create mode 100644 src/com/android/settings/MultitaskSuRequestActivity.java create mode 100644 src/com/android/settings/NotifyActivity.java create mode 100644 src/com/android/settings/PolicyNativeFragment.java create mode 100644 src/com/android/settings/RequestActivity.java create mode 100644 src/com/android/settings/SuReceiver.java diff --git a/Android.mk b/Android.mk index be0aafba58c..7a276a6cf59 100644 --- a/Android.mk +++ b/Android.mk @@ -25,6 +25,12 @@ LOCAL_PRIVILEGED_MODULE := true LOCAL_PROGUARD_FLAG_FILES := proguard.flags +LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true +LOCAL_AAPT_FLAGS += --extra-packages com.koushikdutta.superuser:com.koushikdutta.widgets --auto-add-overlay + +LOCAL_SRC_FILES += $(call all-java-files-under,../../../external/koush/Superuser/Superuser/src) $(call all-java-files-under,../../../external/koush/Widgets/Widgets/src) +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res $(LOCAL_PATH)/../../../external/koush/Widgets/Widgets/res $(LOCAL_PATH)/../../../external/koush/Superuser/Superuser/res + include frameworks/opt/setupwizard/navigationbar/common.mk include $(BUILD_PACKAGE) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 383dc6ef638..280e7e37145 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -70,6 +70,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Device hostname + diff --git a/res/xml/dashboard_categories.xml b/res/xml/dashboard_categories.xml index c338978615e..604b2f3433d 100644 --- a/res/xml/dashboard_categories.xml +++ b/res/xml/dashboard_categories.xml @@ -244,6 +244,14 @@ android:icon="@drawable/ic_settings_print" /> + + + 0) { + DEFAULT_HOSTNAME = "android-".concat(id); + } else { + DEFAULT_HOSTNAME = ""; + } + + setSummary(getText()); + getEditText().setFilters(new InputFilter[] { mHostnameInputFilter }); + getEditText().setHint(DEFAULT_HOSTNAME); + } + + public HostnamePreference(Context context, AttributeSet attrs) { + this(context, attrs, com.android.internal.R.attr.editTextPreferenceStyle); + } + + public HostnamePreference(Context context) { + this(context, null); + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + if (positiveResult) { + String hostname = getEditText().getText().toString(); + + // remove any preceding or succeeding periods or hyphens + hostname = hostname.replaceAll("(?:\\.|-)+$", ""); + hostname = hostname.replaceAll("^(?:\\.|-)+", ""); + + if (hostname.length() == 0) { + if (DEFAULT_HOSTNAME.length() != 0) { + // if no hostname is given, use the default + hostname = DEFAULT_HOSTNAME; + } else { + // if no other name can be determined + // fall back on the current hostname + hostname = getText(); + } + } + setText(hostname); + } + } + + @Override + public void setText(String text) { + if (text == null) { + Log.e(TAG, "tried to set null hostname, request ignored"); + return; + } else if (text.length() == 0) { + Log.w(TAG, "setting empty hostname"); + } else { + Log.i(TAG, "hostname has been set: " + text); + } + SystemProperties.set(PROP_HOSTNAME, text); + persistHostname(text); + setSummary(text); + } + + @Override + public String getText() { + return SystemProperties.get(PROP_HOSTNAME); + } + + @Override + public void onSetInitialValue(boolean restoreValue, Object defaultValue) { + String hostname = getText(); + persistHostname(hostname); + } + + public void persistHostname(String hostname) { + Settings.Secure.putString(getContext().getContentResolver(), + Settings.Secure.DEVICE_HOSTNAME, hostname); + } +} diff --git a/src/com/android/settings/MultitaskSuRequestActivity.java b/src/com/android/settings/MultitaskSuRequestActivity.java new file mode 100644 index 00000000000..01030763684 --- /dev/null +++ b/src/com/android/settings/MultitaskSuRequestActivity.java @@ -0,0 +1,4 @@ +package com.android.settings.cyanogenmod.superuser; + +public class MultitaskSuRequestActivity extends com.koushikdutta.superuser.MultitaskSuRequestActivity { +} \ No newline at end of file diff --git a/src/com/android/settings/NotifyActivity.java b/src/com/android/settings/NotifyActivity.java new file mode 100644 index 00000000000..23aa6a720d0 --- /dev/null +++ b/src/com/android/settings/NotifyActivity.java @@ -0,0 +1,4 @@ +package com.android.settings.cyanogenmod.superuser; + +public class NotifyActivity extends com.koushikdutta.superuser.NotifyActivity { +} \ No newline at end of file diff --git a/src/com/android/settings/PolicyNativeFragment.java b/src/com/android/settings/PolicyNativeFragment.java new file mode 100644 index 00000000000..1c74543bfcf --- /dev/null +++ b/src/com/android/settings/PolicyNativeFragment.java @@ -0,0 +1,4 @@ +package com.android.settings.cyanogenmod.superuser; + +public class PolicyNativeFragment extends com.koushikdutta.superuser.PolicyNativeFragment { +} \ No newline at end of file diff --git a/src/com/android/settings/RequestActivity.java b/src/com/android/settings/RequestActivity.java new file mode 100644 index 00000000000..e6deca49cd6 --- /dev/null +++ b/src/com/android/settings/RequestActivity.java @@ -0,0 +1,4 @@ +package com.android.settings.cyanogenmod.superuser; + +public class RequestActivity extends com.koushikdutta.superuser.RequestActivity { +} \ No newline at end of file diff --git a/src/com/android/settings/SuReceiver.java b/src/com/android/settings/SuReceiver.java new file mode 100644 index 00000000000..c4f9174b04f --- /dev/null +++ b/src/com/android/settings/SuReceiver.java @@ -0,0 +1,4 @@ +package com.android.settings.cyanogenmod.superuser; + +public class SuReceiver extends com.koushikdutta.superuser.SuReceiver { +} \ No newline at end of file From c6a58f59d47460838e4aa56878e56193764a7e93 Mon Sep 17 00:00:00 2001 From: readone Date: Wed, 21 Jan 2015 17:05:49 +0700 Subject: [PATCH 4/5] custom host name --- res/xml/development_prefs.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index fecb721b53b..f2f393f9c95 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -16,10 +16,10 @@ - + android:dialogTitle="@*android:string/bugreport_title" /> + + + Date: Wed, 21 Jan 2015 17:10:31 +0700 Subject: [PATCH 5/5] ercone --- res/values/custom_strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml index 1e1f15ef219..aca82ed7e97 100644 --- a/res/values/custom_strings.xml +++ b/res/values/custom_strings.xml @@ -19,7 +19,7 @@ --> - Omni version + ErcOne version Unknown