From cd88c2f7c30fe58e523e93469dd1fc7a121320f3 Mon Sep 17 00:00:00 2001 From: Alexandra Gherghina Date: Mon, 18 Aug 2014 14:34:08 +0100 Subject: [PATCH 1/3] Fix Account Settings crash Bug: 17020198 Change-Id: I9d4a18381ebb0f57a0e9917c3b7579b0a7feeaf4 --- src/com/android/settings/accounts/AccountSettings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java index 2eb89b0a25b..891fdbb1976 100644 --- a/src/com/android/settings/accounts/AccountSettings.java +++ b/src/com/android/settings/accounts/AccountSettings.java @@ -137,7 +137,7 @@ public class AccountSettings extends SettingsPreferenceFragment currentProfile.getIdentifier())); menu.findItem(R.id.account_settings_menu_auto_sync_personal).setVisible(false); menu.findItem(R.id.account_settings_menu_auto_sync_work).setVisible(false); - } else { + } else if (mProfiles.size() > 1) { // We assume there's only one managed profile, otherwise UI needs to change final UserHandle managedProfile = mProfiles.valueAt(1).userInfo.getUserHandle(); @@ -152,6 +152,8 @@ public class AccountSettings extends SettingsPreferenceFragment .setChecked(ContentResolver.getMasterSyncAutomaticallyAsUser( managedProfile.getIdentifier())); menu.findItem(R.id.account_settings_menu_auto_sync).setVisible(false); + } else { + Log.w(TAG, "Method onPrepareOptionsMenu called before mProfiles was initialized"); } } From f2e39f2ee4f07cfff3915a17b1a394c99e5e7f44 Mon Sep 17 00:00:00 2001 From: Alexandra Gherghina Date: Mon, 18 Aug 2014 13:16:17 +0100 Subject: [PATCH 2/3] Switch to listening for USER_INITIALIZE broadcast in the Settings app. The PRE_BOOT_COMPLETED broadcast is no longer sent when creating a new profile. Also, we no longer listen to BOOT_COMPLETED as that adds too much overload. Bug: 17102460 Change-Id: I05eb56c7a05748e8a91b9717966c20ac586d90ef --- AndroidManifest.xml | 3 +-- src/com/android/settings/ManagedProfileSetup.java | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 27738c35a99..af5af30151d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -97,8 +97,7 @@ - - + diff --git a/src/com/android/settings/ManagedProfileSetup.java b/src/com/android/settings/ManagedProfileSetup.java index 1b3c83876cd..198abe0bf35 100644 --- a/src/com/android/settings/ManagedProfileSetup.java +++ b/src/com/android/settings/ManagedProfileSetup.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.util.Log; import android.os.UserHandle; import android.os.UserManager; @@ -37,6 +38,7 @@ import static android.content.pm.PackageManager.GET_RESOLVED_FILTER; * adds cross-profile intent filters for the appropriate Settings activities). */ public class ManagedProfileSetup extends BroadcastReceiver { + private static final String TAG = "Settings"; private static final String PRIMARY_PROFILE_SETTING = "com.android.settings.PRIMARY_PROFILE_CONTROLLED"; @@ -46,7 +48,8 @@ public class ManagedProfileSetup extends BroadcastReceiver { if (!Utils.isManagedProfile(um)) { return; } - + Log.i(TAG, "Received broadcast: " + broadcast.getAction() + + ". Setting up intent forwarding for managed profile."); final PackageManager pm = context.getPackageManager(); // Clear any previous intent forwarding we set up pm.clearCrossProfileIntentFilters(UserHandle.myUserId()); From 0b65294a7a94dd9a871bcae3a28d512df16a7b4c Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 12 Aug 2014 09:08:29 -0700 Subject: [PATCH 3/3] Added a developer option to save attribute data. After the checkbox for 'Enable view attribute inspection' is checked, newly constructed Views will save their attribute data. Change-Id: Ia6d150d0d9991a2341236a9d35055b811038c849 --- res/values/strings.xml | 2 ++ res/xml/development_prefs.xml | 4 ++++ src/com/android/settings/DevelopmentSettings.java | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 077f571abbd..1b86659382b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3431,6 +3431,8 @@ Allow mock locations Allow mock locations + + Enable view attribute inspection Allow USB debugging? diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index 2a1a5bb2e96..807ae8b7b66 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -86,6 +86,10 @@ android:title="@string/allow_mock_location" android:summary="@string/allow_mock_location_summary"/> + + diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 11dc3c6278e..2cffe289966 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -110,6 +110,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String DEBUG_APP_KEY = "debug_app"; private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger"; private static final String VERIFY_APPS_OVER_USB_KEY = "verify_apps_over_usb"; + private static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes"; private static final String STRICT_MODE_KEY = "strict_mode"; private static final String POINTER_LOCATION_KEY = "pointer_location"; private static final String SHOW_TOUCHES_KEY = "show_touches"; @@ -187,6 +188,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private CheckBoxPreference mBtHciSnoopLog; private CheckBoxPreference mEnableOemUnlock; private CheckBoxPreference mAllowMockLocation; + private CheckBoxPreference mDebugViewAttributes; private PreferenceScreen mPassword; private String mDebugApp; @@ -295,6 +297,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mEnableOemUnlock = null; } mAllowMockLocation = findAndInitCheckboxPref(ALLOW_MOCK_LOCATION); + mDebugViewAttributes = findAndInitCheckboxPref(DEBUG_VIEW_ATTRIBUTES); mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD); mAllPrefs.add(mPassword); @@ -513,6 +516,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment } updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr, Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0); + updateCheckBox(mDebugViewAttributes, Settings.Global.getInt(cr, + Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0); updateHdcpValues(); updatePasswordSummary(); updateDebuggerOptions(); @@ -1019,7 +1024,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private void writeUSBAudioOptions() { Settings.Secure.putInt(getContentResolver(), Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, - mUSBAudio.isChecked() ? 1 : 0); + mUSBAudio.isChecked() ? 1 : 0); } private void updateForceRtlOptions() { @@ -1380,6 +1385,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment Settings.Secure.putInt(getActivity().getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION, mAllowMockLocation.isChecked() ? 1 : 0); + } else if (preference == mDebugViewAttributes) { + Settings.Global.putInt(getActivity().getContentResolver(), + Settings.Global.DEBUG_VIEW_ATTRIBUTES, + mDebugViewAttributes.isChecked() ? 1 : 0); } else if (preference == mDebugAppPref) { startActivityForResult(new Intent(getActivity(), AppPicker.class), RESULT_DEBUG_APP); } else if (preference == mWaitForDebugger) {