Merge "[FRP] Use Lock type as header instead of "Encryption"" into lmp-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 543a8a5..e8eb3ba 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -352,7 +352,7 @@
</activity>
<activity android:name=".EnableWifiTether"
- android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
+ android:theme="@style/Transparent"
android:excludeFromRecents="true" />
<activity android:name="Settings$TetherSettingsActivity"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3e115ad..74062ae 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5573,7 +5573,7 @@
<!-- This is a divider in the SIM cards preferences that is the header of various settings where the user chooses which SIM to use for phone calls, data, and SMS messages [CHAR LIMIT=50] -->
<string name="sim_pref_divider">Preferred SIM for</string>
<!-- When a user chooses this "Ask first" preference for the SIM to use for phone calls, they'll be prompted to choose a SIM every time they initiate a call [CHAR LIMIT=50] -->
- <string name="sim_calls_ask_first_prefs_title">Ask everytime</string>
+ <string name="sim_calls_ask_first_prefs_title">Ask every time</string>
<!-- When a SIM preference hasn't been selected yet, this string is displayed as the pref summary until the user chooses a SIM subscription from the preference list [CHAR LIMIT=50] -->
<string name="sim_selection_required_pref">Selection required</string>
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 5bf9291..e454ed1 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -571,8 +571,8 @@
final boolean required = getActivity().getIntent().getBooleanExtra(
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
utils.setCredentialRequiredToDecrypt(required);
- utils.saveLockPattern(mChosenPattern, isFallback);
utils.setLockPatternEnabled(true);
+ utils.saveLockPattern(mChosenPattern, isFallback);
if (lockVirgin) {
utils.setVisiblePatternEnabled(true);
diff --git a/src/com/android/settings/DeviceAdminSettings.java b/src/com/android/settings/DeviceAdminSettings.java
index bc22637..334d18f 100644
--- a/src/com/android/settings/DeviceAdminSettings.java
+++ b/src/com/android/settings/DeviceAdminSettings.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity;
@@ -25,9 +24,11 @@
import android.app.admin.DeviceAdminInfo;
import android.app.admin.DeviceAdminReceiver;
import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
@@ -49,14 +50,13 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Collection;
public class DeviceAdminSettings extends ListFragment {
static final String TAG = "DeviceAdminSettings";
- static final int DIALOG_WARNING = 1;
private DevicePolicyManager mDPM;
private UserManager mUm;
@@ -70,6 +70,18 @@
private String mDeviceOwnerPkg;
private SparseArray<ComponentName> mProfileOwnerComponents = new SparseArray<ComponentName>();
+ private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // Refresh the list, if state change has been received. It could be that checkboxes
+ // need to be updated
+ if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED.equals(
+ intent.getAction())) {
+ updateList();
+ }
+ }
+ };
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -93,6 +105,10 @@
@Override
public void onResume() {
super.onResume();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
+ getActivity().registerReceiverAsUser(
+ mBroadcastReceiver, UserHandle.ALL, filter, null, null);
mDeviceOwnerPkg = mDPM.getDeviceOwner();
if (mDeviceOwnerPkg != null && !mDPM.isDeviceOwner(mDeviceOwnerPkg)) {
mDeviceOwnerPkg = null;
@@ -107,6 +123,12 @@
updateList();
}
+ @Override
+ public void onPause() {
+ getActivity().unregisterReceiver(mBroadcastReceiver);
+ super.onPause();
+ }
+
/**
* Update the internal collection of available admins for all profiles associated with the
* current user.
@@ -264,6 +286,10 @@
&& (isDeviceOwner(info) || isProfileOwner(info))) {
return false;
}
+ // Disable item if admin is being removed
+ if (isRemovingAdmin(info)) {
+ return false;
+ }
return true;
}
@@ -340,6 +366,10 @@
return mDPM.isAdminActiveAsUser(item.getComponent(), getUserId(item));
}
+ private boolean isRemovingAdmin(DeviceAdminInfo item) {
+ return mDPM.isRemovingAdmin(item.getComponent(), getUserId(item));
+ }
+
/**
* Add device admins to the internal collection that belong to a profile.
*
diff --git a/src/com/android/settings/EnableWifiTether.java b/src/com/android/settings/EnableWifiTether.java
index a67250d..329d92e 100644
--- a/src/com/android/settings/EnableWifiTether.java
+++ b/src/com/android/settings/EnableWifiTether.java
@@ -38,31 +38,16 @@
super.onCreate(icicle);
mProvisionApp = getResources().getStringArray(
com.android.internal.R.array.config_mobile_hotspot_provision_app);
- setContentView(R.layout.settings_main_dashboard);
- startProvisioningIfNecessary();
+ startProvisioning();
}
- private static boolean isProvisioningNeeded(String[] provisionApp) {
- if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)
- || provisionApp == null) {
- return false;
- }
- return (provisionApp.length == 2);
- }
-
- private void startProvisioningIfNecessary() {
-
- if (isProvisioningNeeded(mProvisionApp)) {
- Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
- sendBroadcast(closeDialog);
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClassName(mProvisionApp[0], mProvisionApp[1]);
- intent.putExtra(TETHER_CHOICE, WIFI_TETHERING);
- startActivityForResult(intent, PROVISION_REQUEST);
- } else {
- enableTethering();
- finish();
- }
+ private void startProvisioning() {
+ Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+ sendBroadcast(closeDialog);
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.setClassName(mProvisionApp[0], mProvisionApp[1]);
+ intent.putExtra(TETHER_CHOICE, WIFI_TETHERING);
+ startActivityForResult(intent, PROVISION_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -72,8 +57,8 @@
if (resultCode == Activity.RESULT_OK) {
enableTethering();
}
+ finish();
}
- finish();
}
private void enableTethering() {
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index fd8489b..be031ea 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -17,12 +17,14 @@
package com.android.settings.bluetooth;
import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothUuid;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+import android.os.ParcelUuid;
import android.text.Editable;
import android.text.Html;
import android.text.InputFilter;
@@ -111,6 +113,7 @@
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
+ mDevice.fetchUuidsWithSdp();
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
@@ -318,7 +321,7 @@
}
}
- private void allowPhonebookAccess() {
+ private void processPhonebookAccess() {
CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(mDevice);
if (cachedDevice == null) {
cachedDevice = mCachedDeviceManager.addDevice(
@@ -326,11 +329,14 @@
mBluetoothManager.getProfileManager(),
mDevice);
}
- cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+ ParcelUuid[] uuids = mDevice.getUuids();
+ if (BluetoothUuid.containsAnyUuid(uuids, PbapServerProfile.PBAB_CLIENT_UUIDS)) {
+ cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+ }
}
private void onPair(String value) {
- allowPhonebookAccess();
+ processPhonebookAccess();
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
diff --git a/src/com/android/settings/bluetooth/PbapServerProfile.java b/src/com/android/settings/bluetooth/PbapServerProfile.java
index 87e51a5..6e48b12 100755
--- a/src/com/android/settings/bluetooth/PbapServerProfile.java
+++ b/src/com/android/settings/bluetooth/PbapServerProfile.java
@@ -21,7 +21,9 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothProfile;
+import android.bluetooth.BluetoothUuid;
import android.content.Context;
+import android.os.ParcelUuid;
import android.util.Log;
import com.android.settings.R;
@@ -44,6 +46,13 @@
// Order of this profile in device profiles list
private static final int ORDINAL = 6;
+ // The UUIDs indicate that remote device might access pbap server
+ static final ParcelUuid[] PBAB_CLIENT_UUIDS = {
+ BluetoothUuid.HSP,
+ BluetoothUuid.Handsfree,
+ BluetoothUuid.PBAP_PCE
+ };
+
// These callbacks run on the main thread.
private final class PbapServiceListener
implements BluetoothPbap.ServiceListener {
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index ce8484d..2d1da40 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -343,7 +343,7 @@
}
}
- String rawNumber = mPhone.getLine1Number(); // may be null or empty
+ String rawNumber = mTelephonyManager.getLine1Number(); // may be null or empty
String formattedNumber = null;
if (!TextUtils.isEmpty(rawNumber)) {
formattedNumber = PhoneNumberUtils.formatNumber(rawNumber);
@@ -353,9 +353,7 @@
final String imei = mPhone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
? mPhone.getImei() : mPhone.getDeviceId();
setSummaryText(KEY_IMEI, imei);
- setSummaryText(KEY_IMEI_SV,
- ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
- .getDeviceSoftwareVersion(/*slotId*/));
+ setSummaryText(KEY_IMEI_SV, mTelephonyManager.getDeviceSoftwareVersion(/*slotId*/));
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 7c50a83..f993b8a 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -247,7 +247,7 @@
simPref.setTitle(R.string.calls_title);
simPref.setSummary(phoneAccount == null
- ? getResources().getString(R.string.sim_selection_required_pref)
+ ? getResources().getString(R.string.sim_calls_ask_first_prefs_title)
: (String)telecomManager.getPhoneAccount(phoneAccount).getLabel());
}
@@ -419,7 +419,7 @@
} else {
sir = mSelectableSubInfos.get(position);
holder.title.setText(sir.getDisplayName());
- holder.summary.setText(sir.getNumber());
+ holder.summary.setText(getPhoneNumber(sir));
holder.icon.setImageBitmap(sir.createIconBitmap(mContext));
}
return rowView;
@@ -459,11 +459,11 @@
setTitle(String.format(getResources()
.getString(R.string.sim_editor_title), (mSlotId + 1)));
if (mSubInfoRecord != null) {
- if (TextUtils.isEmpty(mSubInfoRecord.getNumber())) {
+ if (TextUtils.isEmpty(getPhoneNumber(mSubInfoRecord))) {
setSummary(mSubInfoRecord.getDisplayName());
} else {
setSummary(mSubInfoRecord.getDisplayName() + " - " +
- mSubInfoRecord.getNumber());
+ getPhoneNumber(mSubInfoRecord));
setEnabled(true);
}
setIcon(new BitmapDrawable(res, (mSubInfoRecord.createIconBitmap(mContext))));
@@ -518,7 +518,7 @@
});
TextView numberView = (TextView)dialogLayout.findViewById(R.id.number);
- final String rawNumber = mSubInfoRecord.getNumber();
+ final String rawNumber = getPhoneNumber(mSubInfoRecord);
if (TextUtils.isEmpty(rawNumber)) {
numberView.setText(res.getString(com.android.internal.R.string.unknownName));
} else {
@@ -636,6 +636,14 @@
}
+ // Returns the line1Number. Line1number should always be read from TelephonyManager since it can
+ // be overridden for display purposes.
+ private String getPhoneNumber(SubscriptionInfo info) {
+ final TelephonyManager tm =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ return tm.getLine1NumberForSubscriber(info.getSubscriptionId());
+ }
+
private void log(String s) {
Log.d(TAG, s);
}