Merge "Read disk ID from intent" into nyc-dev
diff --git a/src/com/android/settings/CustomListPreference.java b/src/com/android/settings/CustomListPreference.java
index 143c909..ae83013 100644
--- a/src/com/android/settings/CustomListPreference.java
+++ b/src/com/android/settings/CustomListPreference.java
@@ -24,7 +24,6 @@
import android.support.v14.preference.ListPreferenceDialogFragment;
import android.support.v7.preference.ListPreference;
import android.util.AttributeSet;
-import android.view.View;
public class CustomListPreference extends ListPreference {
@@ -51,8 +50,14 @@
return true;
}
+ protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
+ }
+
public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment {
+ private static final java.lang.String KEY_CLICKED_ENTRY_INDEX
+ = "settings.CustomListPrefDialog.KEY_CLICKED_ENTRY_INDEX";
+
private int mClickedDialogEntryIndex;
public static ListPreferenceDialogFragment newInstance(String key) {
@@ -88,10 +93,26 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
+ if (savedInstanceState != null) {
+ mClickedDialogEntryIndex = savedInstanceState.getInt(KEY_CLICKED_ENTRY_INDEX,
+ mClickedDialogEntryIndex);
+ }
getCustomizablePreference().onDialogCreated(dialog);
return dialog;
}
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(KEY_CLICKED_ENTRY_INDEX, mClickedDialogEntryIndex);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getCustomizablePreference().onDialogStateRestored(getDialog(), savedInstanceState);
+ }
+
protected DialogInterface.OnClickListener getOnItemClickListener() {
return new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index e439bed..d972e07 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1124,5 +1124,18 @@
}
return false;
}
+
+ public static CharSequence getApplicationLabel(Context context, String packageName) {
+ try {
+ final ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(
+ packageName,
+ PackageManager.MATCH_DISABLED_COMPONENTS
+ | PackageManager.MATCH_UNINSTALLED_PACKAGES);
+ return appInfo.loadLabel(context.getPackageManager());
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.w(TAG, "Unable to find info for package: " + packageName);
+ }
+ return null;
+ }
}
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 1ef304f..8ad2953 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -904,25 +904,37 @@
}
}
+ addAppInstallerInfoPref(screen);
+ }
+
+ private void addAppInstallerInfoPref(PreferenceScreen screen) {
final String installerPackageName =
getContext().getPackageManager().getInstallerPackageName(mPackageName);
- if (installerPackageName != null) {
- final Intent intent = new Intent(Intent.ACTION_SHOW_APP_INFO)
- .setPackage(installerPackageName);
- final Intent result = resolveIntent(intent);
- if (result != null) {
- result.putExtra(Intent.EXTRA_PACKAGE_NAME, mPackageName);
- PreferenceCategory category = new PreferenceCategory(getPrefContext());
- category.setTitle(R.string.app_install_details_group_title);
- screen.addPreference(category);
- Preference pref = new Preference(getPrefContext());
- pref.setTitle(R.string.app_install_details_title);
- pref.setKey("app_info_store");
- pref.setSummary(getString(R.string.app_install_details_summary, mAppEntry.label));
- pref.setIntent(result);
- category.addPreference(pref);
- }
+ if (installerPackageName == null) {
+ return;
}
+ final CharSequence installerLabel = Utils.getApplicationLabel(getContext(),
+ installerPackageName);
+ if (installerLabel == null) {
+ return;
+ }
+ PreferenceCategory category = new PreferenceCategory(getPrefContext());
+ category.setTitle(R.string.app_install_details_group_title);
+ screen.addPreference(category);
+ Preference pref = new Preference(getPrefContext());
+ pref.setTitle(R.string.app_install_details_title);
+ pref.setKey("app_info_store");
+ pref.setSummary(getString(R.string.app_install_details_summary, installerLabel));
+ final Intent intent = new Intent(Intent.ACTION_SHOW_APP_INFO)
+ .setPackage(installerPackageName);
+ final Intent result = resolveIntent(intent);
+ if (result != null) {
+ result.putExtra(Intent.EXTRA_PACKAGE_NAME, mPackageName);
+ pref.setIntent(result);
+ } else {
+ pref.setEnabled(false);
+ }
+ category.addPreference(pref);
}
private boolean hasPermission(String permission) {
diff --git a/src/com/android/settings/datausage/AppDataUsage.java b/src/com/android/settings/datausage/AppDataUsage.java
index 0bd0615..0e44a9d 100644
--- a/src/com/android/settings/datausage/AppDataUsage.java
+++ b/src/com/android/settings/datausage/AppDataUsage.java
@@ -29,6 +29,7 @@
import android.net.TrafficStats;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -140,7 +141,7 @@
mCycle = (SpinnerPreference) findPreference(KEY_CYCLE);
mCycleAdapter = new CycleAdapter(getContext(), mCycle, mCycleListener, false);
- if (UserHandle.isApp(mAppItem.key)) {
+ if (UserHandle.isApp(mAppItem.key) || mAppItem.key == Process.SYSTEM_UID) {
if (mPackages.size() != 0) {
PackageManager pm = getPackageManager();
try {
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index f070f70..c7bea30 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -35,6 +35,7 @@
import com.android.settings.R;
import com.android.setupwizardlib.SetupWizardLayout;
+import com.android.setupwizardlib.view.Illustration;
import java.text.NumberFormat;
import java.util.List;
@@ -119,10 +120,12 @@
scrollView.setVerticalFadingEdgeEnabled(true);
scrollView.setFadingEdgeLength(scrollView.getVerticalFadingEdgeLength() * 2);
- // Our header assets already have padding baked in
- final View title = findViewById(R.id.suw_layout_title);
- title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
- title.getPaddingBottom());
+ if (findViewById(R.id.suw_layout_decor) instanceof Illustration) {
+ // Our header illustration already have padding baked in
+ final View title = findViewById(R.id.suw_layout_title);
+ title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
+ title.getPaddingBottom());
+ }
}
@Override
diff --git a/src/com/android/settings/notification/NotificationLockscreenPreference.java b/src/com/android/settings/notification/NotificationLockscreenPreference.java
index 8c89968..fc61be3 100644
--- a/src/com/android/settings/notification/NotificationLockscreenPreference.java
+++ b/src/com/android/settings/notification/NotificationLockscreenPreference.java
@@ -24,6 +24,7 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -37,7 +38,6 @@
public class NotificationLockscreenPreference extends RestrictedListPreference {
private boolean mAllowRemoteInput;
- private int mInitialIndex;
private Listener mListener;
private boolean mShowRemoteInput;
private boolean mRemoteInputCheckBoxEnabled = true;
@@ -69,10 +69,8 @@
protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
DialogInterface.OnClickListener innerListener) {
- final String selectedValue = getValue();
- mInitialIndex = (selectedValue == null) ? -1 : findIndexOfValue(selectedValue);
mListener = new Listener(innerListener);
- builder.setSingleChoiceItems(createListAdapter(), mInitialIndex, mListener);
+ builder.setSingleChoiceItems(createListAdapter(), getSelectedValuePos(), mListener);
mShowRemoteInput = getEntryValues().length == 3;
mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0;
@@ -86,8 +84,17 @@
CheckBox view = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input);
view.setChecked(!mAllowRemoteInput);
view.setOnCheckedChangeListener(mListener);
+ }
+
+ @Override
+ protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
+ super.onDialogStateRestored(dialog, savedInstanceState);
+ ListView listView = ((AlertDialog) dialog).getListView();
+ int selectedPosition = listView.getCheckedItemPosition();
+
View panel = dialog.findViewById(com.android.internal.R.id.customPanel);
- panel.setVisibility(checkboxVisibilityForSelectedIndex(mInitialIndex, mShowRemoteInput));
+ panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition,
+ mShowRemoteInput));
mListener.setView(panel);
}
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index d4fc6f8..fd67ea6 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -31,6 +31,7 @@
import android.database.MergeCursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
+import android.database.sqlite.SQLiteFullException;
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.SearchIndexableData;
@@ -1194,35 +1195,39 @@
@Override
protected Void doInBackground(UpdateData... params) {
- final List<SearchIndexableData> dataToUpdate = params[0].dataToUpdate;
- final List<SearchIndexableData> dataToDelete = params[0].dataToDelete;
- final Map<String, List<String>> nonIndexableKeys = params[0].nonIndexableKeys;
-
- final boolean forceUpdate = params[0].forceUpdate;
- final boolean fullIndex = params[0].fullIndex;
-
- final SQLiteDatabase database = getWritableDatabase();
- if (database == null) {
- Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database");
- return null;
- }
- final String localeStr = Locale.getDefault().toString();
-
try {
- database.beginTransaction();
- if (dataToDelete.size() > 0) {
- processDataToDelete(database, localeStr, dataToDelete);
+ final List<SearchIndexableData> dataToUpdate = params[0].dataToUpdate;
+ final List<SearchIndexableData> dataToDelete = params[0].dataToDelete;
+ final Map<String, List<String>> nonIndexableKeys = params[0].nonIndexableKeys;
+
+ final boolean forceUpdate = params[0].forceUpdate;
+ final boolean fullIndex = params[0].fullIndex;
+
+ final SQLiteDatabase database = getWritableDatabase();
+ if (database == null) {
+ Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database");
+ return null;
}
- if (dataToUpdate.size() > 0) {
- processDataToUpdate(database, localeStr, dataToUpdate, nonIndexableKeys,
- forceUpdate);
+ final String localeStr = Locale.getDefault().toString();
+
+ try {
+ database.beginTransaction();
+ if (dataToDelete.size() > 0) {
+ processDataToDelete(database, localeStr, dataToDelete);
+ }
+ if (dataToUpdate.size() > 0) {
+ processDataToUpdate(database, localeStr, dataToUpdate, nonIndexableKeys,
+ forceUpdate);
+ }
+ database.setTransactionSuccessful();
+ } finally {
+ database.endTransaction();
}
- database.setTransactionSuccessful();
- } finally {
- database.endTransaction();
- }
- if (fullIndex) {
- IndexDatabaseHelper.setLocaleIndexed(mContext, localeStr);
+ if (fullIndex) {
+ IndexDatabaseHelper.setLocaleIndexed(mContext, localeStr);
+ }
+ } catch (SQLiteFullException e) {
+ Log.e(LOG_TAG, "Unable to index search, out of space", e);
}
return null;