summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-07 18:49:15 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-07 18:49:15 -0800
commit64e314b61e865919fc8c94165e42dfc5fb7b92f4 (patch)
treeabdadcbf11c325bdf7f79a1ba051043a82909211 /src
parent89ae71c089067d2cd6a3e7304f4126abb57ab9be (diff)
parent46742e0cf933abfcf65be9009cd9262863280c34 (diff)
downloadpackages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.zip
packages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.tar.gz
packages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.tar.bz2
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/packages/apps/Settings into HEAD
Android 6.0.1 release 3 Change-Id: If54bacef03fc826fd02ca48db5ef3a25c8fc7127
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/ApnSettings.java22
-rw-r--r--src/com/android/settings/DataUsageSummary.java29
-rw-r--r--src/com/android/settings/Utils.java4
-rw-r--r--src/com/android/settings/applications/AppLaunchSettings.java126
-rw-r--r--src/com/android/settings/applications/ClearDefaultsPreference.java12
-rwxr-xr-xsrc/com/android/settings/applications/InstalledAppDetails.java8
-rw-r--r--src/com/android/settings/applications/ProcStatsData.java50
-rw-r--r--src/com/android/settings/applications/ProcStatsEntry.java5
-rw-r--r--src/com/android/settings/bluetooth/BluetoothPairingRequest.java6
-rw-r--r--src/com/android/settings/bluetooth/BluetoothPermissionRequest.java13
-rw-r--r--src/com/android/settings/bluetooth/LocalBluetoothPreferences.java17
-rw-r--r--src/com/android/settings/deviceinfo/Status.java6
-rw-r--r--src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java4
-rw-r--r--src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java6
-rw-r--r--src/com/android/settings/search/DynamicIndexableContentMonitor.java9
-rw-r--r--src/com/android/settings/vpn2/ConfigDialogFragment.java15
-rw-r--r--src/com/android/settings/widget/ChartDataUsageView.java3
17 files changed, 251 insertions, 84 deletions
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index a95442b..d32a3a4 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -115,6 +115,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
private boolean mUnavailable;
private boolean mHideImsApn;
+ private boolean mAllowAddingApns;
private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
@Override
@@ -172,6 +173,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
getSystemService(Context.CARRIER_CONFIG_SERVICE);
PersistableBundle b = configManager.getConfig();
mHideImsApn = b.getBoolean(CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL);
+ mAllowAddingApns = b.getBoolean(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL);
}
@Override
@@ -237,15 +239,15 @@ public class ApnSettings extends SettingsPreferenceFragment implements
final String mccmnc = mSubscriptionInfo == null ? ""
: tm.getIccOperatorNumericForData(mSubscriptionInfo.getSubscriptionId());
Log.d(TAG, "mccmnc = " + mccmnc);
- String where = "numeric=\""
- + mccmnc
- + "\" AND NOT (type='ia' AND (apn=\"\" OR apn IS NULL))";
+ StringBuilder where = new StringBuilder("numeric=\"" + mccmnc +
+ "\" AND NOT (type='ia' AND (apn=\"\" OR apn IS NULL)) AND user_visible!=0");
+
if (mHideImsApn) {
- where = where + " AND NOT (type='ims')";
+ where.append(" AND NOT (type='ims')");
}
Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
- "_id", "name", "apn", "type", "mvno_type", "mvno_match_data", "read_only"}, where,
+ "_id", "name", "apn", "type", "mvno_type", "mvno_match_data", "read_only"}, where.toString(),
null, Telephony.Carriers.DEFAULT_SORT_ORDER);
if (cursor != null) {
@@ -341,10 +343,12 @@ public class ApnSettings extends SettingsPreferenceFragment implements
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (!mUnavailable) {
- menu.add(0, MENU_NEW, 0,
- getResources().getString(R.string.menu_new))
- .setIcon(R.drawable.ic_menu_add_white)
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ if (mAllowAddingApns) {
+ menu.add(0, MENU_NEW, 0,
+ getResources().getString(R.string.menu_new))
+ .setIcon(android.R.drawable.ic_menu_add)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ }
menu.add(0, MENU_RESTORE, 0,
getResources().getString(R.string.menu_restore))
.setIcon(android.R.drawable.ic_menu_upload);
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index d0b916f..ef12628 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -1174,6 +1174,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
mCycleAdapter.clear();
final Context context = mCycleSpinner.getContext();
+ NetworkStatsHistory.Entry entry = null;
long historyStart = Long.MAX_VALUE;
long historyEnd = Long.MIN_VALUE;
@@ -1196,9 +1197,20 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
final long cycleStart = computeLastCycleBoundary(cycleEnd, policy);
Log.d(TAG, "generating cs=" + cycleStart + " to ce=" + cycleEnd + " waiting for hs="
+ historyStart);
- mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
+
+ final boolean includeCycle;
+ if (mChartData != null) {
+ entry = mChartData.network.getValues(cycleStart, cycleEnd, entry);
+ includeCycle = (entry.rxBytes + entry.txBytes) > 0;
+ } else {
+ includeCycle = true;
+ }
+
+ if (includeCycle) {
+ mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
+ hasCycles = true;
+ }
cycleEnd = cycleStart;
- hasCycles = true;
}
// one last cycle entry to modify policy cycle day
@@ -1210,7 +1222,18 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
long cycleEnd = historyEnd;
while (cycleEnd > historyStart) {
final long cycleStart = cycleEnd - (DateUtils.WEEK_IN_MILLIS * 4);
- mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
+
+ final boolean includeCycle;
+ if (mChartData != null) {
+ entry = mChartData.network.getValues(cycleStart, cycleEnd, entry);
+ includeCycle = (entry.rxBytes + entry.txBytes) > 0;
+ } else {
+ includeCycle = true;
+ }
+
+ if (includeCycle) {
+ mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
+ }
cycleEnd = cycleStart;
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index b18e27c..6dcbbe5 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1284,9 +1284,9 @@ public final class Utils {
boolean hasPreferred = hasPreferredActivities(pm, packageName)
|| hasUsbDefaults(usbManager, packageName);
int status = pm.getIntentVerificationStatus(packageName, UserHandle.myUserId());
+ // consider a visible current link-handling state to be any explicitly designated behavior
boolean hasDomainURLsPreference =
- (status == PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) ||
- (status == PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER);
+ status != PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
return context.getString(hasPreferred || hasDomainURLsPreference
? R.string.launch_defaults_some
: R.string.launch_defaults_none);
diff --git a/src/com/android/settings/applications/AppLaunchSettings.java b/src/com/android/settings/applications/AppLaunchSettings.java
index c885b02..6c2f241 100644
--- a/src/com/android/settings/applications/AppLaunchSettings.java
+++ b/src/com/android/settings/applications/AppLaunchSettings.java
@@ -17,14 +17,16 @@
package com.android.settings.applications;
import android.app.AlertDialog;
+import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
import android.preference.Preference;
-import android.preference.SwitchPreference;
import android.util.ArraySet;
import android.util.Log;
import android.view.View;
@@ -52,8 +54,17 @@ public class AppLaunchSettings extends AppInfoWithHeader implements OnClickListe
private static final String KEY_SUPPORTED_DOMAIN_URLS = "app_launch_supported_domain_urls";
private static final String KEY_CLEAR_DEFAULTS = "app_launch_clear_defaults";
+ private static final Intent sBrowserIntent;
+ static {
+ sBrowserIntent = new Intent()
+ .setAction(Intent.ACTION_VIEW)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .setData(Uri.parse("http:"));
+ }
+
private PackageManager mPm;
+ private boolean mIsBrowser;
private boolean mHasDomainUrls;
private DropDownPreference mAppLinkState;
private AppDomainsPreference mAppDomainUrls;
@@ -64,62 +75,91 @@ public class AppLaunchSettings extends AppInfoWithHeader implements OnClickListe
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.installed_app_launch_settings);
+ mAppDomainUrls = (AppDomainsPreference) findPreference(KEY_SUPPORTED_DOMAIN_URLS);
+ mClearDefaultsPreference = (ClearDefaultsPreference) findPreference(KEY_CLEAR_DEFAULTS);
+ mAppLinkState = (DropDownPreference) findPreference(KEY_APP_LINK_STATE);
mPm = getActivity().getPackageManager();
+ mIsBrowser = isBrowserApp(mPackageName);
mHasDomainUrls =
(mAppEntry.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS) != 0;
- List<IntentFilterVerificationInfo> iviList = mPm.getIntentFilterVerifications(mPackageName);
-
- List<IntentFilter> filters = mPm.getAllIntentFilters(mPackageName);
-
- mAppDomainUrls = (AppDomainsPreference) findPreference(KEY_SUPPORTED_DOMAIN_URLS);
- CharSequence[] entries = getEntries(mPackageName, iviList, filters);
- mAppDomainUrls.setTitles(entries);
- mAppDomainUrls.setValues(new int[entries.length]);
-
- mClearDefaultsPreference = (ClearDefaultsPreference) findPreference(KEY_CLEAR_DEFAULTS);
+ if (!mIsBrowser) {
+ List<IntentFilterVerificationInfo> iviList = mPm.getIntentFilterVerifications(mPackageName);
+ List<IntentFilter> filters = mPm.getAllIntentFilters(mPackageName);
+ CharSequence[] entries = getEntries(mPackageName, iviList, filters);
+ mAppDomainUrls.setTitles(entries);
+ mAppDomainUrls.setValues(new int[entries.length]);
+ }
buildStateDropDown();
}
- private void buildStateDropDown() {
- mAppLinkState = (DropDownPreference) findPreference(KEY_APP_LINK_STATE);
+ // An app is a "browser" if it has an activity resolution that wound up
+ // marked with the 'handleAllWebDataURI' flag.
+ private boolean isBrowserApp(String packageName) {
+ sBrowserIntent.setPackage(packageName);
+ List<ResolveInfo> list = mPm.queryIntentActivitiesAsUser(sBrowserIntent,
+ PackageManager.MATCH_ALL, UserHandle.myUserId());
+ final int count = list.size();
+ for (int i = 0; i < count; i++) {
+ ResolveInfo info = list.get(i);
+ if (info.activityInfo != null && info.handleAllWebDataURI) {
+ return true;
+ }
+ }
+ return false;
+ }
- // Designed order of states in the dropdown:
- //
- // * always
- // * ask
- // * never
- mAppLinkState.addItem(R.string.app_link_open_always,
- INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS);
- mAppLinkState.addItem(R.string.app_link_open_ask,
- INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK);
- mAppLinkState.addItem(R.string.app_link_open_never,
- INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER);
-
- mAppLinkState.setEnabled(mHasDomainUrls);
- if (mHasDomainUrls) {
- // Present 'undefined' as 'ask' because the OS treats them identically for
- // purposes of the UI (and does the right thing around pending domain
- // verifications that might arrive after the user chooses 'ask' in this UI).
- final int state = mPm.getIntentVerificationStatus(mPackageName, UserHandle.myUserId());
- mAppLinkState.setSelectedValue(
- (state == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED)
- ? INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK
- : state);
-
- // Set the callback only after setting the initial selected item
- mAppLinkState.setCallback(new Callback() {
- @Override
- public boolean onItemSelected(int pos, Object value) {
- return updateAppLinkState((Integer) value);
- }
- });
+ private void buildStateDropDown() {
+ if (mIsBrowser) {
+ // Browsers don't show the app-link prefs
+ mAppLinkState.setShouldDisableView(true);
+ mAppLinkState.setEnabled(false);
+ mAppDomainUrls.setShouldDisableView(true);
+ mAppDomainUrls.setEnabled(false);
+ } else {
+ // Designed order of states in the dropdown:
+ //
+ // * always
+ // * ask
+ // * never
+ mAppLinkState.addItem(R.string.app_link_open_always,
+ INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS);
+ mAppLinkState.addItem(R.string.app_link_open_ask,
+ INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK);
+ mAppLinkState.addItem(R.string.app_link_open_never,
+ INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER);
+
+ mAppLinkState.setEnabled(mHasDomainUrls);
+ if (mHasDomainUrls) {
+ // Present 'undefined' as 'ask' because the OS treats them identically for
+ // purposes of the UI (and does the right thing around pending domain
+ // verifications that might arrive after the user chooses 'ask' in this UI).
+ final int state = mPm.getIntentVerificationStatus(mPackageName, UserHandle.myUserId());
+ mAppLinkState.setSelectedValue(
+ (state == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED)
+ ? INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK
+ : state);
+
+ // Set the callback only after setting the initial selected item
+ mAppLinkState.setCallback(new Callback() {
+ @Override
+ public boolean onItemSelected(int pos, Object value) {
+ return updateAppLinkState((Integer) value);
+ }
+ });
+ }
}
}
private boolean updateAppLinkState(final int newState) {
+ if (mIsBrowser) {
+ // We shouldn't get into this state, but if we do make sure
+ // not to cause any permanent mayhem.
+ return false;
+ }
+
final int userId = UserHandle.myUserId();
final int priorState = mPm.getIntentVerificationStatus(mPackageName, userId);
diff --git a/src/com/android/settings/applications/ClearDefaultsPreference.java b/src/com/android/settings/applications/ClearDefaultsPreference.java
index 8be4be0..bcb6a8a 100644
--- a/src/com/android/settings/applications/ClearDefaultsPreference.java
+++ b/src/com/android/settings/applications/ClearDefaultsPreference.java
@@ -93,9 +93,13 @@ public class ClearDefaultsPreference extends Preference {
@Override
public void onClick(View v) {
if (mUsbManager != null) {
+ final int userId = UserHandle.myUserId();
mPm.clearPackagePreferredActivities(mPackageName);
+ if (isDefaultBrowser(mPackageName)) {
+ mPm.setDefaultBrowserPackageName(null, userId);
+ }
try {
- mUsbManager.clearDefaults(mPackageName, UserHandle.myUserId());
+ mUsbManager.clearDefaults(mPackageName, userId);
} catch (RemoteException e) {
Log.e(TAG, "mUsbManager.clearDefaults", e);
}
@@ -122,6 +126,7 @@ public class ClearDefaultsPreference extends Preference {
TextView autoLaunchView = (TextView) mRootView.findViewById(R.id.auto_launch);
boolean autoLaunchEnabled = Utils.hasPreferredActivities(mPm, mPackageName)
+ || isDefaultBrowser(mPackageName)
|| Utils.hasUsbDefaults(mUsbManager, mPackageName);
if (!autoLaunchEnabled && !hasBindAppWidgetPermission) {
resetLaunchDefaultsUi(autoLaunchView);
@@ -165,6 +170,11 @@ public class ClearDefaultsPreference extends Preference {
return true;
}
+ private boolean isDefaultBrowser(String packageName) {
+ final String defaultBrowser = mPm.getDefaultBrowserPackageName(UserHandle.myUserId());
+ return packageName.equals(defaultBrowser);
+ }
+
private void resetLaunchDefaultsUi(TextView autoLaunchView) {
autoLaunchView.setText(R.string.auto_launch_disable_text);
// Disable clear activities button
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index b5e24e5..c866d29 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -755,6 +755,10 @@ public class InstalledAppDetails extends AppInfoBase
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
public void onClick(View v) {
+ if (mAppEntry == null) {
+ setIntentAndFinish(true, true);
+ return;
+ }
String packageName = mAppEntry.info.packageName;
if(v == mUninstallButton) {
if ((mAppEntry.info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
@@ -1018,7 +1022,6 @@ public class InstalledAppDetails extends AppInfoBase
mPermissionReceiver = null;
final Resources res = getResources();
CharSequence summary = null;
- boolean enabled = false;
if (counts != null) {
int totalCount = counts[1];
int additionalCounts = counts[2];
@@ -1027,8 +1030,6 @@ public class InstalledAppDetails extends AppInfoBase
summary = res.getString(
R.string.runtime_permissions_summary_no_permissions_requested);
} else {
- enabled = true;
-
final ArrayList<CharSequence> list = new ArrayList(Arrays.asList(groupLabels));
if (additionalCounts > 0) {
// N additional permissions.
@@ -1045,7 +1046,6 @@ public class InstalledAppDetails extends AppInfoBase
}
}
mPermissionsPreference.setSummary(summary);
- mPermissionsPreference.setEnabled(enabled);
}
};
}
diff --git a/src/com/android/settings/applications/ProcStatsData.java b/src/com/android/settings/applications/ProcStatsData.java
index 5dba409..0cd80e7 100644
--- a/src/com/android/settings/applications/ProcStatsData.java
+++ b/src/com/android/settings/applications/ProcStatsData.java
@@ -157,6 +157,9 @@ public class ProcStatsData {
ProcessStats.ALL_SCREEN_ADJ, mMemStates, ProcessStats.NON_CACHED_PROC_STATES);
createPkgMap(getProcs(bgTotals, runTotals), bgTotals, runTotals);
+ if (totalMem.sysMemZRamWeight > 0) {
+ distributeZRam(totalMem.sysMemZRamWeight);
+ }
ProcStatsPackageEntry osPkg = createOsEntry(bgTotals, runTotals, totalMem,
mMemInfo.baseCacheRam);
@@ -180,6 +183,45 @@ public class ProcStatsData {
}
}
+ private void distributeZRam(double zramWeight) {
+ // Distribute kernel's Z-Ram across processes, based on how much they have been running.
+ // The idea is that the memory used by the kernel for this is not really the kernel's
+ // responsibility, but that of whoever got swapped in to it... and we will take how
+ // much a process runs for as a sign of the proportion of Z-Ram it is responsible for.
+
+ long zramMem = (long) (zramWeight / memTotalTime);
+ long totalTime = 0;
+ for (int i = pkgEntries.size() - 1; i >= 0; i--) {
+ ProcStatsPackageEntry entry = pkgEntries.get(i);
+ for (int j = entry.mEntries.size() - 1; j >= 0; j--) {
+ ProcStatsEntry proc = entry.mEntries.get(j);
+ totalTime += proc.mRunDuration;
+ }
+ }
+ for (int i = pkgEntries.size() - 1; i >= 0 && totalTime > 0; i--) {
+ ProcStatsPackageEntry entry = pkgEntries.get(i);
+ long pkgRunTime = 0;
+ long maxRunTime = 0;
+ for (int j = entry.mEntries.size() - 1; j >= 0; j--) {
+ ProcStatsEntry proc = entry.mEntries.get(j);
+ pkgRunTime += proc.mRunDuration;
+ if (proc.mRunDuration > maxRunTime) {
+ maxRunTime = proc.mRunDuration;
+ }
+ }
+ long pkgZRam = (zramMem*pkgRunTime)/totalTime;
+ if (pkgZRam > 0) {
+ zramMem -= pkgZRam;
+ totalTime -= pkgRunTime;
+ ProcStatsEntry procEntry = new ProcStatsEntry(entry.mPackage, 0,
+ mContext.getString(R.string.process_stats_os_zram), maxRunTime,
+ pkgZRam, memTotalTime);
+ procEntry.evaluateTargetPackage(mPm, mStats, null, null, sEntryCompare, mUseUss);
+ entry.addEntry(procEntry);
+ }
+ }
+ }
+
private ProcStatsPackageEntry createOsEntry(ProcessDataCollection bgTotals,
ProcessDataCollection runTotals, TotalMemoryUseCollection totalMem, long baseCacheRam) {
// Add in fake entry representing the OS itself.
@@ -188,17 +230,18 @@ public class ProcStatsData {
if (totalMem.sysMemNativeWeight > 0) {
osEntry = new ProcStatsEntry(Utils.OS_PKG, 0,
mContext.getString(R.string.process_stats_os_native), memTotalTime,
- (long) (totalMem.sysMemNativeWeight / memTotalTime));
+ (long) (totalMem.sysMemNativeWeight / memTotalTime), memTotalTime);
osEntry.evaluateTargetPackage(mPm, mStats, bgTotals, runTotals, sEntryCompare, mUseUss);
osPkg.addEntry(osEntry);
}
if (totalMem.sysMemKernelWeight > 0) {
osEntry = new ProcStatsEntry(Utils.OS_PKG, 0,
mContext.getString(R.string.process_stats_os_kernel), memTotalTime,
- (long) (totalMem.sysMemKernelWeight / memTotalTime));
+ (long) (totalMem.sysMemKernelWeight / memTotalTime), memTotalTime);
osEntry.evaluateTargetPackage(mPm, mStats, bgTotals, runTotals, sEntryCompare, mUseUss);
osPkg.addEntry(osEntry);
}
+ /* Turned off now -- zram is being distributed across running apps.
if (totalMem.sysMemZRamWeight > 0) {
osEntry = new ProcStatsEntry(Utils.OS_PKG, 0,
mContext.getString(R.string.process_stats_os_zram), memTotalTime,
@@ -206,10 +249,11 @@ public class ProcStatsData {
osEntry.evaluateTargetPackage(mPm, mStats, bgTotals, runTotals, sEntryCompare, mUseUss);
osPkg.addEntry(osEntry);
}
+ */
if (baseCacheRam > 0) {
osEntry = new ProcStatsEntry(Utils.OS_PKG, 0,
mContext.getString(R.string.process_stats_os_cache), memTotalTime,
- baseCacheRam / 1024);
+ baseCacheRam / 1024, memTotalTime);
osEntry.evaluateTargetPackage(mPm, mStats, bgTotals, runTotals, sEntryCompare, mUseUss);
osPkg.addEntry(osEntry);
}
diff --git a/src/com/android/settings/applications/ProcStatsEntry.java b/src/com/android/settings/applications/ProcStatsEntry.java
index 637003c..97a73c4 100644
--- a/src/com/android/settings/applications/ProcStatsEntry.java
+++ b/src/com/android/settings/applications/ProcStatsEntry.java
@@ -72,13 +72,14 @@ public final class ProcStatsEntry implements Parcelable {
+ " avgpss=" + mAvgBgMem + " weight=" + mBgWeight);
}
- public ProcStatsEntry(String pkgName, int uid, String procName, long duration, long mem) {
+ public ProcStatsEntry(String pkgName, int uid, String procName, long duration, long mem,
+ long memDuration) {
mPackage = pkgName;
mUid = uid;
mName = procName;
mBgDuration = mRunDuration = duration;
mAvgBgMem = mMaxBgMem = mAvgRunMem = mMaxRunMem = mem;
- mBgWeight = mRunWeight = ((double)duration) * mem;
+ mBgWeight = mRunWeight = ((double)memDuration) * mem;
if (DEBUG) Log.d(TAG, "New proc entry " + procName + ": dur=" + mBgDuration
+ " avgpss=" + mAvgBgMem + " weight=" + mBgWeight);
}
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
index 71d6364..3b2a81e 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -65,8 +65,10 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
PowerManager powerManager =
(PowerManager)context.getSystemService(Context.POWER_SERVICE);
String deviceAddress = device != null ? device.getAddress() : null;
- if (powerManager.isScreenOn() &&
- LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress)) {
+ String deviceName = device != null ? device.getName() : null;
+ boolean shouldShowDialog= LocalBluetoothPreferences.shouldShowDialogInForeground(
+ context, deviceAddress, deviceName);
+ if (powerManager.isInteractive() && shouldShowDialog) {
// Since the screen is on and the BT-related activity is in the foreground,
// just open the dialog
context.startActivity(pairingIntent);
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
index 074e0bd..fc6b876 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
@@ -107,6 +107,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, mReturnClass);
String deviceAddress = mDevice != null ? mDevice.getAddress() : null;
+ String deviceName = mDevice != null ? mDevice.getName() : null;
String title = null;
String message = null;
PowerManager powerManager =
@@ -114,7 +115,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
if (powerManager.isScreenOn()
&& LocalBluetoothPreferences.shouldShowDialogInForeground(
- context, deviceAddress)) {
+ context, deviceAddress, deviceName)) {
context.startActivity(connectionAccessIntent);
} else {
// Acquire wakelock so that LCD comes up since screen is off
@@ -134,27 +135,27 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
deleteIntent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
BluetoothDevice.CONNECTION_ACCESS_NO);
deleteIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
- String deviceName = mDevice != null ? mDevice.getAliasName() : null;
+ String deviceAlias = mDevice != null ? mDevice.getAliasName() : null;
switch (mRequestType) {
case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
title = context.getString(R.string.bluetooth_phonebook_request);
message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text,
- deviceName, deviceName);
+ deviceAlias, deviceAlias);
break;
case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
title = context.getString(R.string.bluetooth_map_request);
message = context.getString(R.string.bluetooth_map_acceptance_dialog_text,
- deviceName, deviceName);
+ deviceAlias, deviceAlias);
break;
case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS:
title = context.getString(R.string.bluetooth_sap_request);
message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text,
- deviceName, deviceName);
+ deviceAlias, deviceAlias);
break;
default:
title = context.getString(R.string.bluetooth_connection_permission_request);
message = context.getString(R.string.bluetooth_connection_dialog_text,
- deviceName, deviceName);
+ deviceAlias, deviceAlias);
break;
}
Notification notification = new Notification.Builder(context)
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java b/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java
index 9f2553f..401b13c 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java
@@ -20,6 +20,7 @@ import android.app.QueuedWork;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
+import android.text.TextUtils;
import android.util.Log;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
@@ -62,10 +63,10 @@ final class LocalBluetoothPreferences {
}
static boolean shouldShowDialogInForeground(Context context,
- String deviceAddress) {
+ String deviceAddress, String deviceName) {
LocalBluetoothManager manager = Utils.getLocalBtManager(context);
if (manager == null) {
- if(DEBUG) Log.v(TAG, "manager == null - do not show dialog.");
+ if (DEBUG) Log.v(TAG, "manager == null - do not show dialog.");
return false;
}
@@ -115,6 +116,18 @@ final class LocalBluetoothPreferences {
}
}
}
+
+
+ if (!TextUtils.isEmpty(deviceName)) {
+ // If the device is a custom BT keyboard specifically for this device
+ String packagedKeyboardName = context.getString(
+ com.android.internal.R.string.config_packagedKeyboardName);
+ if (deviceName.equals(packagedKeyboardName)) {
+ if (DEBUG) Log.v(TAG, "showing dialog for packaged keyboard");
+ return true;
+ }
+ }
+
if (DEBUG) Log.v(TAG, "Found no reason to show the dialog - do not show dialog.");
return false;
}
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 87d937d..079639b 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -207,8 +207,10 @@ public class Status extends InstrumentedPreferenceActivity {
removePreferenceFromScreen(KEY_SERIAL_NUMBER);
}
- //Remove SimStatus and Imei for Secondary user as it access Phone b/19165700
- if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
+ // Remove SimStatus and Imei for Secondary user as it access Phone b/19165700
+ // Also remove on Wi-Fi only devices.
+ if (UserHandle.myUserId() != UserHandle.USER_OWNER
+ || Utils.isWifiOnly(this)) {
removePreferenceFromScreen(KEY_SIM_STATUS);
removePreferenceFromScreen(KEY_IMEI_INFO);
}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 6f89ff5..6f73ecd 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -137,6 +137,10 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
@Override
protected void onPostExecute(Exception e) {
final StorageWizardFormatProgress activity = mActivity;
+ if (activity.isDestroyed()) {
+ return;
+ }
+
if (e != null) {
Log.e(TAG, "Failed to partition", e);
Toast.makeText(activity, e.getMessage(), Toast.LENGTH_LONG).show();
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
index 2901673..587f41c 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
@@ -56,7 +56,10 @@ public class UserDictionaryAddWordActivity extends Activity {
// The following will get the EXTRA_WORD and EXTRA_LOCALE fields that are in the intent.
// We do need to add the action by hand, because UserDictionaryAddWordContents expects
// it to be in the bundle, in the EXTRA_MODE key.
- final Bundle args = intent.getExtras();
+ Bundle args = intent.getExtras();
+ if (args == null) {
+ args = new Bundle();
+ }
args.putInt(UserDictionaryAddWordContents.EXTRA_MODE, mode);
if (null != savedInstanceState) {
@@ -74,6 +77,7 @@ public class UserDictionaryAddWordActivity extends Activity {
private void reportBackToCaller(final int resultCode, final Bundle result) {
final Intent senderIntent = getIntent();
+ if (senderIntent.getExtras() == null) return;
final Object listener = senderIntent.getExtras().get("listener");
if (!(listener instanceof Messenger)) return; // This will work if listener is null too.
final Messenger messenger = (Messenger)listener;
diff --git a/src/com/android/settings/search/DynamicIndexableContentMonitor.java b/src/com/android/settings/search/DynamicIndexableContentMonitor.java
index 12bb6ef..e11f564 100644
--- a/src/com/android/settings/search/DynamicIndexableContentMonitor.java
+++ b/src/com/android/settings/search/DynamicIndexableContentMonitor.java
@@ -233,7 +233,8 @@ public final class DynamicIndexableContentMonitor extends PackageMonitor impleme
private void handlePackageAvailable(String packageName) {
if (!mAccessibilityServices.contains(packageName)) {
final Intent intent = getAccessibilityServiceIntent(packageName);
- if (!mContext.getPackageManager().queryIntentServices(intent, 0).isEmpty()) {
+ List<?> services = mContext.getPackageManager().queryIntentServices(intent, 0);
+ if (services != null && !services.isEmpty()) {
mAccessibilityServices.add(packageName);
Index.getInstance(mContext).updateFromClassNameResource(
AccessibilitySettings.class.getName(), false, true);
@@ -243,7 +244,8 @@ public final class DynamicIndexableContentMonitor extends PackageMonitor impleme
if (mHasFeaturePrinting) {
if (!mPrintServices.contains(packageName)) {
final Intent intent = getPrintServiceIntent(packageName);
- if (!mContext.getPackageManager().queryIntentServices(intent, 0).isEmpty()) {
+ List<?> services = mContext.getPackageManager().queryIntentServices(intent, 0);
+ if (services != null && !services.isEmpty()) {
mPrintServices.add(packageName);
Index.getInstance(mContext).updateFromClassNameResource(
PrintSettingsFragment.class.getName(), false, true);
@@ -254,7 +256,8 @@ public final class DynamicIndexableContentMonitor extends PackageMonitor impleme
if (mHasFeatureIme) {
if (!mImeServices.contains(packageName)) {
Intent intent = getIMEServiceIntent(packageName);
- if (!mContext.getPackageManager().queryIntentServices(intent, 0).isEmpty()) {
+ List<?> services = mContext.getPackageManager().queryIntentServices(intent, 0);
+ if (services != null && !services.isEmpty()) {
mImeServices.add(packageName);
Index.getInstance(mContext).updateFromClassNameResource(
InputMethodAndLanguageSettings.class.getName(), false, true);
diff --git a/src/com/android/settings/vpn2/ConfigDialogFragment.java b/src/com/android/settings/vpn2/ConfigDialogFragment.java
index 80f9fcd..a6189a9 100644
--- a/src/com/android/settings/vpn2/ConfigDialogFragment.java
+++ b/src/com/android/settings/vpn2/ConfigDialogFragment.java
@@ -16,6 +16,8 @@
package com.android.settings.vpn2;
+import java.util.Arrays;
+
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
@@ -123,7 +125,18 @@ public class ConfigDialogFragment extends DialogFragment implements
disconnect(profile);
// Delete from KeyStore
- KeyStore.getInstance().delete(Credentials.VPN + profile.key, KeyStore.UID_SELF);
+ KeyStore keyStore = KeyStore.getInstance();
+ keyStore.delete(Credentials.VPN + profile.key, KeyStore.UID_SELF);
+
+ // If this was the current lockdown VPN, clear it.
+ if (Arrays.equals(profile.key.getBytes(), keyStore.get(Credentials.LOCKDOWN_VPN))) {
+ keyStore.delete(Credentials.LOCKDOWN_VPN);
+ try {
+ mService.updateLockdownVpn();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to clear lockdown VPN configuration");
+ }
+ }
}
dismiss();
}
diff --git a/src/com/android/settings/widget/ChartDataUsageView.java b/src/com/android/settings/widget/ChartDataUsageView.java
index cc9acd6..6fb805b 100644
--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.net.NetworkPolicy;
import android.net.NetworkStatsHistory;
+import android.net.TrafficStats;
import android.os.Handler;
import android.os.Message;
import android.text.Spannable;
@@ -33,6 +34,7 @@ import android.text.format.Formatter.BytesResult;
import android.text.format.Time;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.View;
@@ -535,6 +537,7 @@ public class ChartDataUsageView extends ChartView {
@Override
public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
+ value = MathUtils.constrain(value, 0, TrafficStats.TB_IN_BYTES);
final BytesResult result = Formatter.formatBytes(res, value,
Formatter.FLAG_SHORTER | Formatter.FLAG_CALCULATE_ROUNDED);
setText(builder, sSpanSize, result.value, "^1");