Merge commit '6a19c5cabf1615ffce654a1203554bbaa1d1f72e' into HEAD
Change-Id: Ic7cd65ff8d2fd397a77f635b21bd06bfc17a38dc
This commit is contained in:
@@ -116,6 +116,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
|
||||
private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
|
||||
private static final String TUNER_UI_KEY = "tuner_ui";
|
||||
private static final String COLOR_TEMPERATURE_PROPERTY = "persist.sys.debug.color_temp";
|
||||
|
||||
private static final String DEBUG_APP_KEY = "debug_app";
|
||||
private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
|
||||
@@ -167,6 +168,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
|
||||
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
|
||||
private static final String KEY_COLOR_MODE = "color_mode";
|
||||
private static final String COLOR_TEMPERATURE_KEY = "color_temperature";
|
||||
|
||||
private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY =
|
||||
"bluetooth_disable_absolute_volume";
|
||||
@@ -270,6 +272,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
|
||||
private ColorModePreference mColorModePreference;
|
||||
|
||||
private SwitchPreference mColorTemperaturePreference;
|
||||
|
||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
||||
|
||||
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
||||
@@ -302,7 +306,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||
|
||||
if (android.os.Process.myUserHandle().getIdentifier() != UserHandle.USER_OWNER
|
||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
|
||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)
|
||||
|| Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||
// Block access to developer options if the user is not the owner, if user policy
|
||||
// restricts it, or if the device has not been provisioned
|
||||
mUnavailable = true;
|
||||
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
|
||||
return;
|
||||
@@ -432,6 +440,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
removePreference(KEY_COLOR_MODE);
|
||||
mColorModePreference = null;
|
||||
}
|
||||
|
||||
mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
|
||||
if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
|
||||
mAllPrefs.add(mColorTemperaturePreference);
|
||||
mResetSwitchPrefs.add(mColorTemperaturePreference);
|
||||
} else {
|
||||
removePreference(COLOR_TEMPERATURE_KEY);
|
||||
mColorTemperaturePreference = null;
|
||||
}
|
||||
}
|
||||
|
||||
private ListPreference addListPreference(String prefKey) {
|
||||
@@ -639,6 +656,9 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
updateMobileDataAlwaysOnOptions();
|
||||
updateSimulateColorSpace();
|
||||
updateUSBAudioOptions();
|
||||
if (mColorTemperaturePreference != null) {
|
||||
updateColorTemperature();
|
||||
}
|
||||
updateBluetoothDisableAbsVolumeOptions();
|
||||
}
|
||||
|
||||
@@ -1184,6 +1204,17 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColorTemperature() {
|
||||
updateSwitchPreference(mColorTemperaturePreference,
|
||||
SystemProperties.getBoolean(COLOR_TEMPERATURE_PROPERTY, false));
|
||||
}
|
||||
|
||||
private void writeColorTemperature() {
|
||||
SystemProperties.set(COLOR_TEMPERATURE_PROPERTY,
|
||||
mColorTemperaturePreference.isChecked() ? "1" : "0");
|
||||
pokeSystemProperties();
|
||||
}
|
||||
|
||||
private void updateUSBAudioOptions() {
|
||||
updateSwitchPreference(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
|
||||
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
|
||||
@@ -1764,6 +1795,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
writeLegacyDhcpClientOptions();
|
||||
} else if (preference == mMobileDataAlwaysOn) {
|
||||
writeMobileDataAlwaysOnOptions();
|
||||
} else if (preference == mColorTemperaturePreference) {
|
||||
writeColorTemperature();
|
||||
} else if (preference == mUSBAudio) {
|
||||
writeUSBAudioOptions();
|
||||
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
|
||||
|
||||
@@ -228,6 +228,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
||||
// Don't enable developer options for secondary users.
|
||||
if (UserHandle.myUserId() != UserHandle.USER_OWNER) return true;
|
||||
|
||||
// Don't enable developer options until device has been provisioned
|
||||
if (Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||
if (um.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) return true;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.provider.Settings;
|
||||
import android.service.persistentdata.PersistentDataBlockManager;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
@@ -63,8 +64,12 @@ public class MasterClearConfirm extends InstrumentedFragment {
|
||||
final PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
|
||||
getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
|
||||
|
||||
if (pdbManager != null && !pdbManager.getOemUnlockEnabled()) {
|
||||
// if OEM unlock is enabled, this will be wiped during FR process.
|
||||
if (pdbManager != null && !pdbManager.getOemUnlockEnabled() &&
|
||||
Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 0) != 0) {
|
||||
// if OEM unlock is enabled, this will be wiped during FR process. If disabled, it
|
||||
// will be wiped here, unless the device is still being provisioned, in which case
|
||||
// the persistent data block will be preserved.
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
int mOldOrientation;
|
||||
ProgressDialog mProgressDialog;
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.widget.Button;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.ims.ImsManager;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
|
||||
@@ -100,6 +101,8 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
|
||||
btManager.getAdapter().factoryReset();
|
||||
}
|
||||
|
||||
ImsManager.factoryReset(context);
|
||||
|
||||
Toast.makeText(context, R.string.reset_network_complete_toast, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -23,9 +23,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
@@ -58,6 +60,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
||||
private TextView mEmptyView;
|
||||
|
||||
private boolean mValidListener = false;
|
||||
private boolean mEditableWfcMode = true;
|
||||
|
||||
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||
/*
|
||||
@@ -161,6 +164,15 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
||||
|
||||
mIntentFilter = new IntentFilter();
|
||||
mIntentFilter.addAction(ImsManager.ACTION_IMS_REGISTRATION_ERROR);
|
||||
|
||||
CarrierConfigManager configManager = (CarrierConfigManager)
|
||||
getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
||||
if (configManager != null) {
|
||||
PersistableBundle b = configManager.getConfig();
|
||||
if (b != null) {
|
||||
mEditableWfcMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,6 +252,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
||||
} else {
|
||||
preferenceScreen.removePreference(mButtonWfcMode);
|
||||
}
|
||||
preferenceScreen.setEnabled(mEditableWfcMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,11 +34,9 @@ public class AppStateWriteSettingsBridge extends AppStateAppOpsBridge {
|
||||
private static final String TAG = "AppStateWriteSettingsBridge";
|
||||
private static final int APP_OPS_OP_CODE = AppOpsManager.OP_WRITE_SETTINGS;
|
||||
private static final String PM_WRITE_SETTINGS = Manifest.permission.WRITE_SETTINGS;
|
||||
private static final String PM_CHANGE_NETWORK_STATE = Manifest.permission.CHANGE_NETWORK_STATE;
|
||||
// CHANGE_NETWORK_STATE is now merged with WRITE_SETTINGS
|
||||
|
||||
private static final String[] PM_PERMISSIONS = {
|
||||
PM_WRITE_SETTINGS,
|
||||
PM_CHANGE_NETWORK_STATE
|
||||
PM_WRITE_SETTINGS
|
||||
};
|
||||
|
||||
public AppStateWriteSettingsBridge(Context context, ApplicationsState appState, Callback
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -195,8 +195,14 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
||||
} else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){
|
||||
contactSharing.setChecked(false);
|
||||
} else {
|
||||
contactSharing.setChecked(true);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
||||
if (mDevice.getBluetoothClass().getDeviceClass()
|
||||
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
|
||||
contactSharing.setChecked(true);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
||||
} else {
|
||||
contactSharing.setChecked(false);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
|
||||
}
|
||||
}
|
||||
|
||||
contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@@ -209,12 +215,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mDevice.getBluetoothClass().getDeviceClass()
|
||||
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
|
||||
contactSharing.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
contactSharing.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mPairingView = (EditText) view.findViewById(R.id.text);
|
||||
mPairingView.addTextChangedListener(this);
|
||||
alphanumericPin.setOnCheckedChangeListener(this);
|
||||
@@ -267,8 +268,14 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
||||
} else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){
|
||||
contactSharing.setChecked(false);
|
||||
} else {
|
||||
contactSharing.setChecked(true);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
||||
if (mDevice.getBluetoothClass().getDeviceClass()
|
||||
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
|
||||
contactSharing.setChecked(true);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
|
||||
} else {
|
||||
contactSharing.setChecked(false);
|
||||
mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
|
||||
}
|
||||
}
|
||||
|
||||
contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@@ -281,12 +288,6 @@ public final class BluetoothPairingDialog extends AlertActivity implements
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mDevice.getBluetoothClass().getDeviceClass()
|
||||
== BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
|
||||
contactSharing.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
contactSharing.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String messageCaption = null;
|
||||
String pairingContent = null;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user