Merge "Fix 2579481: Fix change alphanumeric password security hole" into froyo
diff --git a/src/com/android/settings/ApplicationSettings.java b/src/com/android/settings/ApplicationSettings.java
index 9b7a919..c743f1c 100644
--- a/src/com/android/settings/ApplicationSettings.java
+++ b/src/com/android/settings/ApplicationSettings.java
@@ -62,7 +62,7 @@
mInstallLocation = (ListPreference) findPreference(KEY_APP_INSTALL_LOCATION);
// Is app default install location set?
boolean userSetInstLocation = (Settings.System.getInt(getContentResolver(),
- Settings.System.SET_INSTALL_LOCATION, 0) != 0);
+ Settings.Secure.SET_INSTALL_LOCATION, 0) != 0);
if (!userSetInstLocation) {
getPreferenceScreen().removePreference(mInstallLocation);
} else {
@@ -86,17 +86,17 @@
protected void handleUpdateAppInstallLocation(final String value) {
if(APP_INSTALL_DEVICE_ID.equals(value)) {
Settings.System.putInt(getContentResolver(),
- Settings.System.DEFAULT_INSTALL_LOCATION, APP_INSTALL_DEVICE);
+ Settings.Secure.DEFAULT_INSTALL_LOCATION, APP_INSTALL_DEVICE);
} else if (APP_INSTALL_SDCARD_ID.equals(value)) {
Settings.System.putInt(getContentResolver(),
- Settings.System.DEFAULT_INSTALL_LOCATION, APP_INSTALL_SDCARD);
+ Settings.Secure.DEFAULT_INSTALL_LOCATION, APP_INSTALL_SDCARD);
} else if (APP_INSTALL_AUTO_ID.equals(value)) {
Settings.System.putInt(getContentResolver(),
- Settings.System.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
+ Settings.Secure.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
} else {
// Should not happen, default to prompt...
Settings.System.putInt(getContentResolver(),
- Settings.System.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
+ Settings.Secure.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
}
mInstallLocation.setValue(value);
}
@@ -143,7 +143,7 @@
private String getAppInstallLocation() {
int selectedLocation = Settings.System.getInt(getContentResolver(),
- Settings.System.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
+ Settings.Secure.DEFAULT_INSTALL_LOCATION, APP_INSTALL_AUTO);
if (selectedLocation == APP_INSTALL_DEVICE) {
return APP_INSTALL_DEVICE_ID;
} else if (selectedLocation == APP_INSTALL_SDCARD) {
diff --git a/src/com/android/settings/InstalledAppDetails.java b/src/com/android/settings/InstalledAppDetails.java
index 41ba49b..52e9844 100644
--- a/src/com/android/settings/InstalledAppDetails.java
+++ b/src/com/android/settings/InstalledAppDetails.java
@@ -18,6 +18,7 @@
package com.android.settings;
+import com.android.internal.content.PackageHelper;
import com.android.settings.R;
import android.app.Activity;
import android.app.ActivityManager;
@@ -30,6 +31,7 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageDataObserver;
+import android.content.pm.IPackageManager;
import android.content.pm.IPackageMoveObserver;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageInfo;
@@ -40,8 +42,11 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.storage.IMountService;
import android.text.format.Formatter;
import android.util.Log;
import java.util.ArrayList;
@@ -230,17 +235,36 @@
mMoveAppButton.setText(R.string.move_app);
} else if ((mAppInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
mMoveAppButton.setText(R.string.move_app_to_internal);
+ // Always let apps move to internal storage from sdcard.
moveDisable = false;
} else {
- moveDisable = (mAppInfo.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0 ||
- (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
mMoveAppButton.setText(R.string.move_app_to_sdcard);
- }
- if (pkgInfo != null && pkgInfo.installLocation ==
- PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY) {
- // If an application explicitly specifies install location
- // consider that
- moveDisable = true;
+ if ((mAppInfo.flags & ApplicationInfo.FLAG_FORWARD_LOCK) != 0 ||
+ (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ moveDisable = true;
+ } else if (pkgInfo != null) {
+ if (pkgInfo.installLocation ==
+ PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY) {
+ // If an application explicitly specifies install location
+ // consider that
+ moveDisable = true;
+ } else if (pkgInfo.installLocation == PackageInfo.INSTALL_LOCATION_UNSPECIFIED) {
+ IPackageManager ipm = IPackageManager.Stub.asInterface(
+ ServiceManager.getService("package"));
+ int loc;
+ try {
+ loc = ipm.getInstallLocation();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Is Pakage Manager running?");
+ return;
+ }
+ if (loc == PackageHelper.APP_INSTALL_EXTERNAL) {
+ // For apps with no preference and the default value set
+ // to install on sdcard.
+ moveDisable = false;
+ }
+ }
+ }
}
if (moveDisable) {
mMoveAppButton.setEnabled(false);
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 2ab7a50..79b081f 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -19,6 +19,7 @@
import com.android.settings.wifi.WifiApEnabler;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.os.Bundle;
import android.os.SystemProperties;
import android.content.BroadcastReceiver;
@@ -50,6 +51,9 @@
private static final String WIFI_HELP_MODIFIER = "wifi_";
private static final String HELP_URL = "file:///android_asset/html/%y_%z/tethering_%xhelp.html";
+ private static final int DIALOG_TETHER_HELP = 1;
+
+ private WebView mView;
private CheckBoxPreference mUsbTether;
private CheckBoxPreference mEnableWifiAp;
@@ -89,8 +93,35 @@
getPreferenceScreen().removePreference(mWifiApSettings);
}
mWifiApEnabler = new WifiApEnabler(this, mEnableWifiAp);
+ mView = new WebView(this);
}
+ @Override
+ protected Dialog onCreateDialog(int id) {
+ if (id == DIALOG_TETHER_HELP) {
+ Locale locale = Locale.getDefault();
+ String url = HELP_URL.replace("%y", locale.getLanguage().toLowerCase());
+ url = url.replace("%z", locale.getCountry().toLowerCase());
+
+ if ((mUsbRegexs.length != 0) && (mWifiRegexs.length == 0)) {
+ url = url.replace("%x", USB_HELP_MODIFIER);
+ } else if ((mWifiRegexs.length != 0) && (mUsbRegexs.length == 0)) {
+ url = url.replace("%x", WIFI_HELP_MODIFIER);
+ } else {
+ // could assert that both wifi and usb have regexs, but the default
+ // is to use this anyway so no check is needed
+ url = url.replace("%x", "");
+ }
+ mView.loadUrl(url);
+
+ return new AlertDialog.Builder(this)
+ .setCancelable(true)
+ .setTitle(R.string.tethering_help_button_text)
+ .setView(mView)
+ .create();
+ }
+ return null;
+ }
private class TetherChangeReceiver extends BroadcastReceiver {
public void onReceive(Context content, Intent intent) {
@@ -244,27 +275,8 @@
mUsbTether.setSummary("");
}
} else if (preference == mTetherHelp) {
- Locale locale = Locale.getDefault();
- String url = HELP_URL.replace("%y", locale.getLanguage().toLowerCase());
- url = url.replace("%z", locale.getCountry().toLowerCase());
- if ((mUsbRegexs.length != 0) && (mWifiRegexs.length == 0)) {
- url = url.replace("%x", USB_HELP_MODIFIER);
- } else if ((mWifiRegexs.length != 0) && (mUsbRegexs.length == 0)) {
- url = url.replace("%x", WIFI_HELP_MODIFIER);
- } else {
- // could assert that both wifi and usb have regexs, but the default
- // is to use this anyway so no check is needed
- url = url.replace("%x", "");
- }
- WebView view = new WebView(this);
- view.loadUrl(url);
-
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setCancelable(true);
- builder.setTitle(R.string.tethering_help_button_text);
- builder.setView(view);
- builder.show();
+ showDialog(DIALOG_TETHER_HELP);
}
return false;
}
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java
index fa9ea58..d6e11d7 100644
--- a/src/com/android/settings/TextToSpeechSettings.java
+++ b/src/com/android/settings/TextToSpeechSettings.java
@@ -99,6 +99,7 @@
private boolean mVoicesMissing = false;
private TextToSpeech mTts = null;
+ private boolean mTtsStarted = false;
/**
* Request code (arbitrary value) for voice data check through
@@ -120,8 +121,7 @@
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
mEnableDemo = false;
- initClickers();
- initDefaultSettings();
+ mTtsStarted = false;
mTts = new TextToSpeech(this, this);
}
@@ -130,12 +130,14 @@
@Override
protected void onStart() {
super.onStart();
- // whenever we return to this screen, we don't know the state of the
- // system, so we have to recheck that we can play the demo, or it must be disabled.
- // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount
- initClickers();
- updateWidgetState();
- checkVoiceData();
+ if (mTtsStarted){
+ // whenever we return to this screen, we don't know the state of the
+ // system, so we have to recheck that we can play the demo, or it must be disabled.
+ // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount
+ initClickers();
+ updateWidgetState();
+ checkVoiceData();
+ }
}
@@ -327,7 +329,6 @@
*/
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
- Log.v(TAG, "TTS engine for settings screen initialized.");
mEnableDemo = true;
if (mDefaultLanguage == null) {
mDefaultLanguage = Locale.getDefault().getISO3Language();
@@ -340,6 +341,12 @@
}
mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
mTts.setSpeechRate((float)(mDefaultRate/100.0f));
+ initDefaultSettings();
+ initClickers();
+ updateWidgetState();
+ checkVoiceData();
+ mTtsStarted = true;
+ Log.v(TAG, "TTS engine for settings screen initialized.");
} else {
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
mEnableDemo = false;
@@ -361,11 +368,10 @@
updateWidgetState();
return;
}
- // TODO (clchen): Add these extras to TextToSpeech.Engine
ArrayList<String> available =
- data.getStringArrayListExtra("TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES");
+ data.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
ArrayList<String> unavailable =
- data.getStringArrayListExtra("TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES");
+ data.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES);
if ((available == null) || (unavailable == null)){
// The CHECK_TTS_DATA activity for the plugin did not run properly;
// disable the preview and install controls and return.
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index ec8df3c..57bffa9 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -53,7 +53,7 @@
private static final String TAG = "CachedBluetoothDevice";
private static final boolean D = LocalBluetoothManager.D;
private static final boolean V = LocalBluetoothManager.V;
- private static final boolean DEBUG = true; // STOPSHIP - disable before final rom
+ private static final boolean DEBUG = false;
private static final int CONTEXT_ITEM_CONNECT = Menu.FIRST + 1;
private static final int CONTEXT_ITEM_DISCONNECT = Menu.FIRST + 2;
diff --git a/src/com/android/settings/wifi/WifiApSettings.java b/src/com/android/settings/wifi/WifiApSettings.java
index bca4835..0815238 100644
--- a/src/com/android/settings/wifi/WifiApSettings.java
+++ b/src/com/android/settings/wifi/WifiApSettings.java
@@ -17,6 +17,7 @@
package com.android.settings.wifi;
import com.android.settings.R;
+import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@@ -48,6 +49,8 @@
private static final int OPEN_INDEX = 0;
private static final int WPA_INDEX = 1;
+ private static final int DIALOG_AP_SETTINGS = 1;
+
private String[] mSecurityType;
private Preference mCreateNetwork;
private CheckBoxPreference mEnableWifiAp;
@@ -85,6 +88,15 @@
}
@Override
+ protected Dialog onCreateDialog(int id) {
+ if (id == DIALOG_AP_SETTINGS) {
+ mDialog = new WifiApDialog(this, this, mWifiConfig);
+ return mDialog;
+ }
+ return null;
+ }
+
+ @Override
protected void onResume() {
super.onResume();
mWifiApEnabler.resume();
@@ -99,19 +111,11 @@
@Override
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
if (preference == mCreateNetwork) {
- showDialog();
+ showDialog(DIALOG_AP_SETTINGS);
}
return true;
}
- private void showDialog() {
- if (mDialog != null) {
- mDialog.dismiss();
- }
- mDialog = new WifiApDialog(this, this, mWifiConfig);
- mDialog.show();
- }
-
public void onClick(DialogInterface dialogInterface, int button) {
if (button == DialogInterface.BUTTON_POSITIVE) {