Merge change Iec1f8a2e into eclair
* changes:
Add Turkish accented letters for G and S on the hard keyboard.
diff --git a/api/current.xml b/api/current.xml
index e4d6308..673ebe8 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -10956,6 +10956,17 @@
visibility="public"
>
</field>
+<field name="stat_notify_sdcard_prepare"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301675"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="stat_notify_sdcard_usb"
type="int"
transient="false"
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 76a133b..fc00a4c 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -122,7 +122,8 @@
private static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
private static final boolean DEBUG_BROADCAST = false;
private static final boolean DEBUG_RESULTS = false;
- private static final boolean DEBUG_BACKUP = true;
+ private static final boolean DEBUG_BACKUP = false;
+ private static final boolean DEBUG_CONFIGURATION = false;
private static final long MIN_TIME_BETWEEN_GCS = 5*1000;
private static final Pattern PATTERN_SEMICOLON = Pattern.compile(";");
private static final int SQLITE_MEM_RELEASED_EVENT_LOG_TAG = 75003;
@@ -2388,6 +2389,8 @@
appContext.setOuterContext(activity);
CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
Configuration config = new Configuration(mConfiguration);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Launching activity "
+ + r.activityInfo.name + " with config " + config);
activity.attach(appContext, this, getInstrumentation(), r.token,
r.ident, app, r.intent, r.activityInfo, title, r.parent,
r.embeddedID, r.lastNonConfigurationInstance,
@@ -2954,6 +2957,8 @@
if (!r.activity.mFinished && !a.mStartedActivity
&& r.activity.mDecor != null && !r.hideForNow) {
if (r.newConfig != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Resuming activity "
+ + r.activityInfo.name + " with newConfig " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
}
@@ -3195,6 +3200,8 @@
}
}
if (r.newConfig != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Updating activity vis "
+ + r.activityInfo.name + " with new config " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
}
@@ -3476,6 +3483,10 @@
Configuration changedConfig = null;
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ + tmp.token + " with configChanges=0x"
+ + Integer.toHexString(configChanges));
+
// First: make sure we have the most recent configuration and most
// recent version of the activity, or skip it if some previous call
// had taken a more recent version.
@@ -3494,6 +3505,7 @@
}
if (tmp == null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Abort, activity not relaunching!");
return;
}
@@ -3503,13 +3515,16 @@
}
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ + tmp.token + ": changedConfig=" + changedConfig);
+
// If there was a pending configuration change, execute it first.
if (changedConfig != null) {
handleConfigurationChanged(changedConfig);
}
ActivityRecord r = mActivities.get(tmp.token);
- if (localLOGV) Log.v(TAG, "Handling relaunch of " + r);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handling relaunch of " + r);
if (r == null) {
return;
}
@@ -3595,6 +3610,8 @@
// the activity manager may, before then, decide the
// activity needs to be destroyed to handle its new
// configuration.
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Setting activity "
+ + ar.activityInfo.name + " newConfig=" + newConfig);
ar.newConfig = newConfig;
}
}
@@ -3652,6 +3669,8 @@
}
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Config callback " + cb
+ + ": shouldChangeConfig=" + shouldChangeConfig);
if (shouldChangeConfig) {
cb.onConfigurationChanged(config);
@@ -3679,6 +3698,9 @@
ArrayList<ComponentCallbacks> callbacks
= new ArrayList<ComponentCallbacks>();
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle configuration changed: "
+ + config);
+
synchronized(mPackages) {
if (mConfiguration == null) {
mConfiguration = new Configuration();
@@ -3729,6 +3751,9 @@
return;
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle activity config changed: "
+ + r.activityInfo.name);
+
performConfigurationChanged(r.activity, mConfiguration);
}
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index 0582e34..8ba7c01 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -2760,6 +2760,7 @@
if (mFile.exists()) {
if (!mFile.renameTo(mBackupFile)) {
Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
+ return false;
}
}
diff --git a/core/java/android/app/BackupAgent.java b/core/java/android/app/BackupAgent.java
index 0ac8a1e..b207998 100644
--- a/core/java/android/app/BackupAgent.java
+++ b/core/java/android/app/BackupAgent.java
@@ -36,6 +36,7 @@
*/
public abstract class BackupAgent extends ContextWrapper {
private static final String TAG = "BackupAgent";
+ private static final boolean DEBUG = false;
public BackupAgent() {
super(null);
@@ -116,7 +117,7 @@
ParcelFileDescriptor data,
ParcelFileDescriptor newState) throws RemoteException {
// !!! TODO - real implementation; for now just invoke the callbacks directly
- Log.v(TAG, "doBackup() invoked");
+ if (DEBUG) Log.v(TAG, "doBackup() invoked");
BackupDataOutput output = new BackupDataOutput(data.getFileDescriptor());
try {
BackupAgent.this.onBackup(oldState, output, newState);
@@ -132,7 +133,7 @@
public void doRestore(ParcelFileDescriptor data, int appVersionCode,
ParcelFileDescriptor newState) throws RemoteException {
// !!! TODO - real implementation; for now just invoke the callbacks directly
- Log.v(TAG, "doRestore() invoked");
+ if (DEBUG) Log.v(TAG, "doRestore() invoked");
BackupDataInput input = new BackupDataInput(data.getFileDescriptor());
try {
BackupAgent.this.onRestore(input, appVersionCode, newState);
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 38cac87..69c87ee 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -44,6 +44,12 @@
import java.io.IOException;
import java.io.InputStream;
+/**
+ * Provides access to the system wallpaper. With WallpaperManager, you can
+ * get the current wallpaper, get the desired dimensions for the wallpaper, set
+ * the wallpaper, and more. Get an instance of WallpaperManager with
+ * {@link #getInstance(android.content.Context) getInstance()}.
+ */
public class WallpaperManager {
private static String TAG = "WallpaperManager";
private static boolean DEBUG = false;
@@ -310,8 +316,11 @@
}
/**
- * Like {@link #peekDrawable}, but always returns a valid Drawable. If
+ * Retrieve the current system wallpaper; if
* no wallpaper is set, the system default wallpaper is returned.
+ * This is returned as an
+ * abstract Drawable that you can install in a View to display whatever
+ * wallpaper the user has currently set.
*
* @return Returns a Drawable object that will draw the wallpaper.
*/
@@ -326,10 +335,10 @@
}
/**
- * Retrieve the current system wallpaper. This is returned as an
+ * Retrieve the current system wallpaper; if there is no wallpaper set,
+ * a null pointer is returned. This is returned as an
* abstract Drawable that you can install in a View to display whatever
- * wallpaper the user has currently set. If there is no wallpaper set,
- * a null pointer is returned.
+ * wallpaper the user has currently set.
*
* @return Returns a Drawable object that will draw the wallpaper or a
* null pointer if these is none.
@@ -345,8 +354,15 @@
}
/**
- * Like {@link #peekFastDrawable}, but always returns a valid Drawable. If
- * no wallpaper is set, the system default wallpaper is returned.
+ * Like {@link #getDrawable()}, but the returned Drawable has a number
+ * of limitations to reduce its overhead as much as possible. It will
+ * never scale the wallpaper (only centering it if the requested bounds
+ * do match the bitmap bounds, which should not be typical), doesn't
+ * allow setting an alpha, color filter, or other attributes, etc. The
+ * bounds of the returned drawable will be initialized to the same bounds
+ * as the wallpaper, so normally you will not need to touch it. The
+ * drawable also assumes that it will be used in a context running in
+ * the same density as the screen (not in density compatibility mode).
*
* @return Returns a Drawable object that will draw the wallpaper.
*/
@@ -360,15 +376,8 @@
}
/**
- * Like {@link #peekDrawable()}, but the returned Drawable has a number
- * of limitations to reduce its overhead as much as possible: it will
- * never scale the wallpaper (only centering it if the requested bounds
- * do match the bitmap bounds, which should not be typical), doesn't
- * allow setting an alpha, color filter, or other attributes, etc. The
- * bounds of the returned drawable will be initialized to the same bounds
- * as the wallpaper, so normally you will not need to touch it. The
- * drawable also assumes that it will be used in a context running in
- * the same density as the screen (not in density compatibility mode).
+ * Like {@link #getFastDrawable()}, but if there is no wallpaper set,
+ * a null pointer is returned.
*
* @return Returns an optimized Drawable object that will draw the
* wallpaper or a null pointer if these is none.
@@ -566,7 +575,7 @@
* make sense when the wallpaper is larger than the screen.
*
* @param windowToken The window who these offsets should be associated
- * with, as returned by {@link android.view.View#getWindowVisibility()
+ * with, as returned by {@link android.view.View#getWindowToken()
* View.getWindowToken()}.
* @param xOffset The offset olong the X dimension, from 0 to 1.
* @param yOffset The offset along the Y dimension, from 0 to 1.
@@ -589,7 +598,7 @@
* to scroll from whatever its last offsets were.
*
* @param windowToken The window who these offsets should be associated
- * with, as returned by {@link android.view.View#getWindowVisibility()
+ * with, as returned by {@link android.view.View#getWindowToken()
* View.getWindowToken()}.
*/
public void clearWallpaperOffsets(IBinder windowToken) {
diff --git a/core/java/android/backup/AbsoluteFileBackupHelper.java b/core/java/android/backup/AbsoluteFileBackupHelper.java
index ab24675..1dbccc9 100644
--- a/core/java/android/backup/AbsoluteFileBackupHelper.java
+++ b/core/java/android/backup/AbsoluteFileBackupHelper.java
@@ -31,6 +31,7 @@
*/
public class AbsoluteFileBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "AbsoluteFileBackupHelper";
+ private static final boolean DEBUG = false;
Context mContext;
String[] mFiles;
@@ -54,8 +55,7 @@
}
public void restoreEntity(BackupDataInputStream data) {
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
+ if (DEBUG) Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
if (isKeyInList(key, mFiles)) {
File f = new File(key);
diff --git a/core/java/android/backup/FileBackupHelper.java b/core/java/android/backup/FileBackupHelper.java
index 4058497..dacfc8f 100644
--- a/core/java/android/backup/FileBackupHelper.java
+++ b/core/java/android/backup/FileBackupHelper.java
@@ -26,6 +26,7 @@
/** @hide */
public class FileBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "FileBackupHelper";
+ private static final boolean DEBUG = false;
Context mContext;
File mFilesDir;
@@ -60,8 +61,7 @@
}
public void restoreEntity(BackupDataInputStream data) {
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
+ if (DEBUG) Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
if (isKeyInList(key, mFiles)) {
File f = new File(mFilesDir, key);
diff --git a/core/java/android/backup/SharedPreferencesBackupHelper.java b/core/java/android/backup/SharedPreferencesBackupHelper.java
index 4a7b399..6a0bc96 100644
--- a/core/java/android/backup/SharedPreferencesBackupHelper.java
+++ b/core/java/android/backup/SharedPreferencesBackupHelper.java
@@ -26,6 +26,7 @@
/** @hide */
public class SharedPreferencesBackupHelper extends FileBackupHelperBase implements BackupHelper {
private static final String TAG = "SharedPreferencesBackupHelper";
+ private static final boolean DEBUG = false;
private Context mContext;
private String[] mPrefGroups;
@@ -56,9 +57,9 @@
public void restoreEntity(BackupDataInputStream data) {
Context context = mContext;
- // TODO: turn this off before ship
- Log.d(TAG, "got entity '" + data.getKey() + "' size=" + data.size());
String key = data.getKey();
+ if (DEBUG) Log.d(TAG, "got entity '" + key + "' size=" + data.size());
+
if (isKeyInList(key, mPrefGroups)) {
File f = context.getSharedPrefsFile(key).getAbsoluteFile();
writeFile(f, data);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 5fb5768..b785dbf 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1330,7 +1330,7 @@
public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
/**
* Broadcast Action: The current system wallpaper has changed. See
- * {@link Context#getWallpaper} for retrieving the new wallpaper.
+ * {@link android.app.WallpaperManager} for retrieving the new wallpaper.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index 11d984d..fb2608a 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -103,7 +103,7 @@
public static final String MESG_SUCCESS = "success";
public static final String MESG_CANCELED = "canceled";
- public static final int MAX_HISTORY = 15;
+ public static final int MAX_HISTORY = 100;
private static final int MSG_WRITE_STATUS = 1;
private static final long WRITE_STATUS_DELAY = 1000*60*10; // 10 minutes
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 3e117d4..83e63b9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -986,6 +986,7 @@
}
final int NP = PackageParser.NEW_PERMISSIONS.length;
+ StringBuilder implicitPerms = null;
for (int ip=0; ip<NP; ip++) {
final PackageParser.NewPermissionInfo npi
= PackageParser.NEW_PERMISSIONS[ip];
@@ -993,11 +994,20 @@
break;
}
if (!pkg.requestedPermissions.contains(npi.name)) {
- Log.i(TAG, "Impliciting adding " + npi.name + " to old pkg "
- + pkg.packageName);
+ if (implicitPerms == null) {
+ implicitPerms = new StringBuilder(128);
+ implicitPerms.append(pkg.packageName);
+ implicitPerms.append(": compat added ");
+ } else {
+ implicitPerms.append(' ');
+ }
+ implicitPerms.append(npi.name);
pkg.requestedPermissions.add(npi.name);
}
}
+ if (implicitPerms != null) {
+ Log.i(TAG, implicitPerms.toString());
+ }
if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
&& pkg.applicationInfo.targetSdkVersion
@@ -1335,8 +1345,10 @@
com.android.internal.R.styleable.AndroidManifestApplication_backupAgent);
if (backupAgent != null) {
ai.backupAgentName = buildClassName(pkgName, backupAgent, outError);
- Log.v(TAG, "android:backupAgent = " + ai.backupAgentName
- + " from " + pkgName + "+" + backupAgent);
+ if (false) {
+ Log.v(TAG, "android:backupAgent = " + ai.backupAgentName
+ + " from " + pkgName + "+" + backupAgent);
+ }
if (sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestApplication_killAfterRestore,
@@ -1526,8 +1538,9 @@
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <application>: " + tagName);
+ Log.w(TAG, "Unknown element under <application>: " + tagName
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
} else {
@@ -1572,25 +1585,6 @@
return true;
}
- private boolean parseComponentInfo(Package owner, int flags,
- ComponentInfo outInfo, String[] outError, String tag, TypedArray sa,
- int nameRes, int labelRes, int iconRes, int processRes,
- int enabledRes) {
- if (!parsePackageItemInfo(owner, outInfo, outError, tag, sa,
- nameRes, labelRes, iconRes)) {
- return false;
- }
-
- if (processRes != 0) {
- outInfo.processName = buildProcessName(owner.applicationInfo.packageName,
- owner.applicationInfo.processName, sa.getNonResourceString(processRes),
- flags, mSeparateProcesses, outError);
- }
- outInfo.enabled = sa.getBoolean(enabledRes, true);
-
- return outError[0] == null;
- }
-
private Activity parseActivity(Package owner, Resources res,
XmlPullParser parser, AttributeSet attrs, int flags, String[] outError,
boolean receiver) throws XmlPullParserException, IOException {
@@ -1749,9 +1743,13 @@
if (!RIGID_PARSER) {
Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
if (receiver) {
- Log.w(TAG, "Unknown element under <receiver>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <receiver>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
} else {
- Log.w(TAG, "Unknown element under <activity>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <activity>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
}
XmlUtils.skipCurrentTag(parser);
continue;
@@ -1891,8 +1889,9 @@
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <activity-alias>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <activity-alias>: " + parser.getName()
+ + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2055,8 +2054,9 @@
outInfo.info.grantUriPermissions = true;
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>");
+ Log.w(TAG, "Unknown element under <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2096,8 +2096,9 @@
if (!havePerm) {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No readPermission or writePermssion for <path-permission>");
+ Log.w(TAG, "No readPermission or writePermssion for <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2141,8 +2142,9 @@
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>");
+ Log.w(TAG, "No path, pathPrefix, or pathPattern for <path-permission>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2153,9 +2155,9 @@
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under <provider>: "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2233,9 +2235,9 @@
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under <service>: "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2272,9 +2274,9 @@
}
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
Log.w(TAG, "Unknown element under " + tag + ": "
- + parser.getName());
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -2330,8 +2332,9 @@
data.putFloat(name, v.getFloat());
} else {
if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "<meta-data> only supports string, integer, float, color, boolean, and resource reference types");
+ Log.w(TAG, "<meta-data> only supports string, integer, float, color, boolean, and resource reference types: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
} else {
outError[0] = "<meta-data> only supports string, integer, float, color, boolean, and resource reference types";
data = null;
@@ -2365,6 +2368,7 @@
com.android.internal.R.styleable.AndroidManifestIntentFilter_priority, 0);
if (priority > 0 && isActivity && (flags&PARSE_IS_SYSTEM) == 0) {
Log.w(TAG, "Activity with priority > 0, forcing to 0 at "
+ + mArchiveSourcePath + " "
+ parser.getPositionDescription());
priority = 0;
}
@@ -2462,8 +2466,9 @@
sa.recycle();
XmlUtils.skipCurrentTag(parser);
} else if (!RIGID_PARSER) {
- Log.w(TAG, "Problem in package " + mArchiveSourcePath + ":");
- Log.w(TAG, "Unknown element under <intent-filter>: " + parser.getName());
+ Log.w(TAG, "Unknown element under <intent-filter>: "
+ + parser.getName() + " at " + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
} else {
outError[0] = "Bad element under <intent-filter>: " + parser.getName();
diff --git a/core/java/android/pim/vcard/ContactStruct.java b/core/java/android/pim/vcard/ContactStruct.java
index e87c796..a078f15 100644
--- a/core/java/android/pim/vcard/ContactStruct.java
+++ b/core/java/android/pim/vcard/ContactStruct.java
@@ -810,7 +810,8 @@
} else if (propName.equals("NICKNAME") || propName.equals("X-NICKNAME")) {
addNickName(propValue);
} else if (propName.equals("SOUND")) {
- if (Constants.ATTR_TYPE_X_IRMC_N.equals(paramMap.get(Constants.ATTR_TYPE))) {
+ Collection<String> typeCollection = paramMap.get(Constants.ATTR_TYPE);
+ if (typeCollection != null && typeCollection.contains(Constants.ATTR_TYPE_X_IRMC_N)) {
handlePhoneticNameFromSound(propValueList);
} else {
// Ignore this field since Android cannot understand what it is.
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index cebb75c..08a2a9f 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -102,7 +102,6 @@
private int mLayoutResId = com.android.internal.R.layout.preference;
private int mWidgetLayoutResId;
private boolean mHasSpecifiedLayout = false;
- private View mLayoutView;
private OnPreferenceChangeInternalListener mListener;
@@ -337,7 +336,7 @@
if (!mHasSpecifiedLayout) {
mHasSpecifiedLayout = true;
}
- mLayoutView = null;
+
mLayoutResId = layoutResId;
}
@@ -361,7 +360,6 @@
* @see #setLayoutResource(int)
*/
public void setWidgetLayoutResource(int widgetLayoutResId) {
- mLayoutView = null;
mWidgetLayoutResId = widgetLayoutResId;
}
@@ -389,10 +387,7 @@
*/
public View getView(View convertView, ViewGroup parent) {
if (convertView == null) {
- if (mLayoutView == null) {
- mLayoutView = onCreateView(parent);
- }
- convertView = mLayoutView;
+ convertView = onCreateView(parent);
}
onBindView(convertView);
return convertView;
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f27902d..2ca17f6 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -464,7 +464,7 @@
resolver.insert(uri, values);
return true;
} catch (SQLException e) {
- Log.e(TAG, "Can't set key " + name + " in " + uri, e);
+ Log.w(TAG, "Can't set key " + name + " in " + uri, e);
return false;
}
}
@@ -501,7 +501,7 @@
mValues.put(name, value);
} catch (SQLException e) {
// SQL error: return null, but don't cache it.
- Log.e(TAG, "Can't get key " + name + " from " + mUri, e);
+ Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
} finally {
if (c != null) c.close();
}
@@ -3746,7 +3746,7 @@
// The stored URL is bad... ignore it.
} catch (IllegalArgumentException e) {
// Column not found
- Log.e(TAG, "Intent column not found", e);
+ Log.w(TAG, "Intent column not found", e);
}
}
} finally {
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 4a5f431..d61b42f 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -112,6 +112,13 @@
Message msg = Message.obtain(mHandler, MESSAGE_CONNECT_TO, device);
mHandler.sendMessageDelayed(msg, 6000);
}
+ } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
+ synchronized (this) {
+ if (mAudioDevices.containsKey(device)) {
+ int state = mAudioDevices.get(device);
+ handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
+ }
+ }
}
}
};
@@ -135,6 +142,7 @@
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
+ mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
mContext.registerReceiver(mReceiver, mIntentFilter);
mAudioDevices = new HashMap<BluetoothDevice, Integer>();
@@ -333,10 +341,11 @@
return false;
}
String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
- if (path == null) {
+ Integer state = mAudioDevices.get(device);
+ if (path == null || state == null) {
return false;
}
- switch (mAudioDevices.get(device)) {
+ switch (state.intValue()) {
case BluetoothA2dp.STATE_CONNECTED:
return true;
case BluetoothA2dp.STATE_PLAYING:
@@ -354,10 +363,11 @@
return false;
}
String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());
- if (path == null) {
+ Integer state = mAudioDevices.get(device);
+ if (path == null || state == null) {
return false;
}
- switch (mAudioDevices.get(device)) {
+ switch (state.intValue()) {
case BluetoothA2dp.STATE_PLAYING:
return true;
case BluetoothA2dp.STATE_CONNECTED:
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 037e9d3..0152223 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -403,9 +403,13 @@
mBluetoothService.cancelPairingUserInput(address);
return null;
}
- // Set state to BONDING, for incoming connections it will be set here.
- // For outgoing connections, it gets set when call createBond.
- mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
+ // Set state to BONDING. For incoming connections it will be set here.
+ // For outgoing connections, it gets set when we call createBond.
+ // Also set it only when the state is not already Bonded, we can sometimes
+ // get an authorization request from the remote end if it doesn't have the link key
+ // while we still have it.
+ if (mBluetoothService.getBondState().getBondState(address) != BluetoothDevice.BOND_BONDED)
+ mBluetoothService.getBondState().setBondState(address, BluetoothDevice.BOND_BONDING);
return address;
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 50358c2..da04032 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2863,17 +2863,31 @@
invalidate();
if (mNeedToAdjustWebTextView) {
mNeedToAdjustWebTextView = false;
- mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- contentToViewDimension(
- nativeFocusCandidateTextSize()));
- Rect bounds = nativeFocusCandidateNodeBounds();
- Rect vBox = contentToViewRect(bounds);
- mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
- vBox.height());
- // If it is a password field, start drawing the
- // WebTextView once again.
- if (nativeFocusCandidateIsPassword()) {
- mWebTextView.setInPassword(true);
+ Rect contentBounds = nativeFocusCandidateNodeBounds();
+ Rect vBox = contentToViewRect(contentBounds);
+ Rect visibleRect = new Rect();
+ calcOurVisibleRect(visibleRect);
+ if (visibleRect.contains(vBox)) {
+ // As a result of the zoom, the textfield is now on
+ // screen. Place the WebTextView in its new place,
+ // accounting for our new scroll/zoom values.
+ mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
+ contentToViewDimension(
+ nativeFocusCandidateTextSize()));
+ mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
+ vBox.height());
+ // If it is a password field, start drawing the
+ // WebTextView once again.
+ if (nativeFocusCandidateIsPassword()) {
+ mWebTextView.setInPassword(true);
+ }
+ } else {
+ // The textfield is now off screen. The user probably
+ // was not zooming to see the textfield better. Remove
+ // the WebTextView. If the user types a key, and the
+ // textfield is still in focus, we will reconstruct
+ // the WebTextView and scroll it back on screen.
+ mWebTextView.remove();
}
}
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 7a8a3be..4b26b8f 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -2988,7 +2988,10 @@
if (mBackupFile.exists()) {
mBackupFile.delete();
}
- mFile.renameTo(mBackupFile);
+ if (!mFile.renameTo(mBackupFile)) {
+ Log.w("BatteryStats", "Failed to back up file before writing new stats");
+ return;
+ }
}
try {
@@ -3003,8 +3006,14 @@
mBackupFile.delete();
mLastWriteTime = SystemClock.elapsedRealtime();
+ return;
} catch (IOException e) {
- Log.e("BatteryStats", "Error writing battery statistics", e);
+ Log.w("BatteryStats", "Error writing battery statistics", e);
+ }
+ if (mFile.exists()) {
+ if (!mFile.delete()) {
+ Log.w(TAG, "Failed to delete mangled file " + mFile);
+ }
}
}
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard.png b/core/res/res/drawable-hdpi/stat_notify_sdcard.png
old mode 100755
new mode 100644
index 320d63d..d3b624b
--- a/core/res/res/drawable-hdpi/stat_notify_sdcard.png
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png b/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png
new file mode 100644
index 0000000..a483ba2
--- /dev/null
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard_prepare.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png b/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
old mode 100755
new mode 100644
index 1b49692..a5e369e2
--- a/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
+++ b/core/res/res/drawable-hdpi/stat_notify_sdcard_usb.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard.png b/core/res/res/drawable-mdpi/stat_notify_sdcard.png
index feac3b7..23093ac 100644
--- a/core/res/res/drawable-mdpi/stat_notify_sdcard.png
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png b/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png
new file mode 100644
index 0000000..9abb1c9
--- /dev/null
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard_prepare.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png b/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
index 6de4043..9880694 100644
--- a/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
+++ b/core/res/res/drawable-mdpi/stat_notify_sdcard_usb.png
Binary files differ
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
index b2bc845..d551a26 100644
--- a/core/res/res/layout/contact_header.xml
+++ b/core/res/res/layout/contact_header.xml
@@ -23,10 +23,9 @@
android:paddingRight="5dip">
<android.widget.QuickContactBadge android:id="@+id/photo"
- android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
- android:layout_marginRight="10dip"
- android:layout_marginLeft="10dip"
+ android:layout_marginRight="8dip"
+ android:layout_marginLeft="-1dip"
style="@*android:style/Widget.QuickContactBadge.WindowSmall" />
/>
@@ -60,7 +59,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:maxLines="1"
+ android:singleLine="true"
android:ellipsize="end"
android:layout_marginTop="-4dip"
/>
diff --git a/core/res/res/layout/keyguard_screen_rotary_unlock.xml b/core/res/res/layout/keyguard_screen_rotary_unlock.xml
index 9f18124..59b69cd 100644
--- a/core/res/res/layout/keyguard_screen_rotary_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_rotary_unlock.xml
@@ -30,7 +30,7 @@
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<TextView
@@ -135,4 +135,4 @@
</RelativeLayout>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml b/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
index 5fe1dde..c503455 100644
--- a/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_rotary_unlock_land.xml
@@ -30,7 +30,7 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<!-- left side -->
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 059e899..3e00ae8e1 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -26,7 +26,7 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#A0000000"
+ android:background="#70000000"
>
<!-- left side: instructions and emergency call button -->
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index f3c7559..0525356 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -26,7 +26,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
- android:background="#A0000000"
+ android:background="#70000000"
>
<LinearLayout
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 8807665..52e32002 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1193,4 +1193,5 @@
can be seen. -->
<public type="drawable" name="screen_background_dark_transparent" />
<public type="drawable" name="screen_background_light_transparent" />
+ <public type="drawable" name="stat_notify_sdcard_prepare" />
</resources>
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 2ed5d3b..8e967fb 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -603,18 +603,19 @@
return result;
}
- // Check if parameters are for an output
- PlaybackThread *playbackThread = checkPlaybackThread_l(ioHandle);
- if (playbackThread != NULL) {
- return playbackThread->setParameters(keyValuePairs);
+ // hold a strong ref on thread in case closeOutput() or closeInput() is called
+ // and the thread is exited once the lock is released
+ sp<ThreadBase> thread;
+ {
+ Mutex::Autolock _l(mLock);
+ thread = checkPlaybackThread_l(ioHandle);
+ if (thread == NULL) {
+ thread = checkRecordThread_l(ioHandle);
+ }
}
-
- // Check if parameters are for an input
- RecordThread *recordThread = checkRecordThread_l(ioHandle);
- if (recordThread != NULL) {
- return recordThread->setParameters(keyValuePairs);
+ if (thread != NULL) {
+ return thread->setParameters(keyValuePairs);
}
-
return BAD_VALUE;
}
@@ -626,6 +627,9 @@
if (ioHandle == 0) {
return mAudioHardware->getParameters(keys);
}
+
+ Mutex::Autolock _l(mLock);
+
PlaybackThread *playbackThread = checkPlaybackThread_l(ioHandle);
if (playbackThread != NULL) {
return playbackThread->getParameters(keys);
@@ -736,7 +740,7 @@
void AudioFlinger::ThreadBase::exit()
{
- // keep a strong ref on ourself so that we want get
+ // keep a strong ref on ourself so that we wont get
// destroyed in the middle of requestExitAndWait()
sp <ThreadBase> strongMe = this;
@@ -778,9 +782,14 @@
mNewParameters.add(keyValuePairs);
mWaitWorkCV.signal();
- mParamCond.wait(mLock);
- status = mParamStatus;
- mWaitWorkCV.signal();
+ // wait condition with timeout in case the thread loop has exited
+ // before the request could be processed
+ if (mParamCond.waitRelative(mLock, seconds(2)) == NO_ERROR) {
+ status = mParamStatus;
+ mWaitWorkCV.signal();
+ } else {
+ status = TIMED_OUT;
+ }
return status;
}
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 2894bf0..07222ec 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -294,8 +294,8 @@
this, index, w, h, strerror(-err));
} else {
LOGD_IF(DEBUG_RESIZE,
- "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d",
- this, index, w, h);
+ "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d, handle=%p",
+ this, index, w, h, buffer->handle);
}
if (err == NO_ERROR && buffer->handle != 0) {
@@ -318,22 +318,18 @@
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- // Index of the back buffer
- const bool backbufferChanged = (front.w != temp.w) || (front.h != temp.h);
- if (backbufferChanged) {
+ if ((front.requested_w != temp.requested_w) ||
+ (front.requested_h != temp.requested_h)) {
// the size changed, we need to ask our client to request a new buffer
LOGD_IF(DEBUG_RESIZE,
"resize (layer=%p), requested (%dx%d), "
"drawing (%d,%d), (%dx%d), (%dx%d)",
- this, int(temp.w), int(temp.h),
- int(drawingState().w), int(drawingState().h),
+ this,
+ int(temp.requested_w), int(temp.requested_h),
+ int(front.requested_w), int(front.requested_h),
int(mBuffers[0]->getWidth()), int(mBuffers[0]->getHeight()),
int(mBuffers[1]->getWidth()), int(mBuffers[1]->getHeight()));
- // record the new size, form this point on, when the client request a
- // buffer, it'll get the new size.
- setDrawingSize(temp.w, temp.h);
-
// we're being resized and there is a freeze display request,
// acquire a freeze lock, so that the screen stays put
// until we've redrawn at the new size; this is to avoid
@@ -346,9 +342,16 @@
}
}
- // recompute the visible region
- flags |= Layer::eVisibleRegion;
- this->contentDirty = true;
+ // this will make sure LayerBase::doTransaction doesn't update
+ // the drawing state's size
+ Layer::State& editDraw(mDrawingState);
+ editDraw.requested_w = temp.requested_w;
+ editDraw.requested_h = temp.requested_h;
+
+ // record the new size, form this point on, when the client request a
+ // buffer, it'll get the new size.
+ setDrawingSize(temp.requested_w, temp.requested_h);
+
// all buffers need reallocation
lcblk->reallocate();
}
@@ -392,11 +395,35 @@
const Region dirty(lcblk->getDirtyRegion(buf));
mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() );
-
const Layer::State& front(drawingState());
- if (newFrontBuffer->getWidth() == front.w &&
- newFrontBuffer->getHeight() ==front.h) {
- mFreezeLock.clear();
+ if (newFrontBuffer->getWidth() == front.requested_w &&
+ newFrontBuffer->getHeight() == front.requested_h)
+ {
+ if ((front.w != front.requested_w) ||
+ (front.h != front.requested_h))
+ {
+ // Here we pretend the transaction happened by updating the
+ // current and drawing states. Drawing state is only accessed
+ // in this thread, no need to have it locked
+ Layer::State& editDraw(mDrawingState);
+ editDraw.w = editDraw.requested_w;
+ editDraw.h = editDraw.requested_h;
+
+ // We also need to update the current state so that we don't
+ // end-up doing too much work during the next transaction.
+ // NOTE: We actually don't need hold the transaction lock here
+ // because State::w and State::h are only accessed from
+ // this thread
+ Layer::State& editTemp(currentState());
+ editTemp.w = editDraw.w;
+ editTemp.h = editDraw.h;
+
+ // recompute visible region
+ recomputeVisibleRegions = true;
+
+ // we now have the correct size, unfreeze the screen
+ mFreezeLock.clear();
+ }
}
// FIXME: signal an event if we have more buffers waiting
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 7692d0f..d83c8429 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -83,26 +83,22 @@
if (flags & ISurfaceComposer::eNonPremultiplied)
mPremultipliedAlpha = false;
- mCurrentState.z = 0;
- mCurrentState.w = w;
- mCurrentState.h = h;
- mCurrentState.alpha = 0xFF;
- mCurrentState.flags = layerFlags;
- mCurrentState.sequence = 0;
+ mCurrentState.z = 0;
+ mCurrentState.w = w;
+ mCurrentState.h = h;
+ mCurrentState.requested_w = w;
+ mCurrentState.requested_h = h;
+ mCurrentState.alpha = 0xFF;
+ mCurrentState.flags = layerFlags;
+ mCurrentState.sequence = 0;
mCurrentState.transform.set(0, 0);
// drawing state & current state are identical
mDrawingState = mCurrentState;
}
-void LayerBase::commitTransaction(bool skipSize) {
- const uint32_t w = mDrawingState.w;
- const uint32_t h = mDrawingState.h;
+void LayerBase::commitTransaction() {
mDrawingState = mCurrentState;
- if (skipSize) {
- mDrawingState.w = w;
- mDrawingState.h = h;
- }
}
void LayerBase::forceVisibilityTransaction() {
// this can be called without SurfaceFlinger.mStateLock, but if we
@@ -138,10 +134,10 @@
return true;
}
bool LayerBase::setSize(uint32_t w, uint32_t h) {
- if (mCurrentState.w == w && mCurrentState.h == h)
+ if (mCurrentState.requested_w == w && mCurrentState.requested_h == h)
return false;
- mCurrentState.w = w;
- mCurrentState.h = h;
+ mCurrentState.requested_w = w;
+ mCurrentState.requested_h = h;
requestTransaction();
return true;
}
@@ -198,13 +194,25 @@
const Layer::State& front(drawingState());
const Layer::State& temp(currentState());
- if (temp.sequence != front.sequence) {
+ if ((front.requested_w != temp.requested_w) ||
+ (front.requested_h != temp.requested_h)) {
+ // resize the layer, set the physical size to the requested size
+ Layer::State& editTemp(currentState());
+ editTemp.w = temp.requested_w;
+ editTemp.h = temp.requested_h;
+ }
+
+ if ((front.w != temp.w) || (front.h != temp.h)) {
// invalidate and recompute the visible regions if needed
- flags |= eVisibleRegion;
+ flags |= Layer::eVisibleRegion;
this->contentDirty = true;
}
if (temp.sequence != front.sequence) {
+ // invalidate and recompute the visible regions if needed
+ flags |= eVisibleRegion;
+ this->contentDirty = true;
+
const bool linearFiltering = mUseLinearFiltering;
mUseLinearFiltering = false;
if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
@@ -217,7 +225,7 @@
}
// Commit the transaction
- commitTransaction(flags & eRestartTransaction);
+ commitTransaction();
return flags;
}
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index 233737d..16ee542 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -88,6 +88,8 @@
struct State {
uint32_t w;
uint32_t h;
+ uint32_t requested_w;
+ uint32_t requested_h;
uint32_t z;
uint8_t alpha;
uint8_t flags;
@@ -107,7 +109,7 @@
bool setTransparentRegionHint(const Region& opaque);
bool setFlags(uint8_t flags, uint8_t mask);
- void commitTransaction(bool skipSize);
+ void commitTransaction();
bool requestTransaction();
void forceVisibilityTransaction();
@@ -211,7 +213,6 @@
enum { // flags for doTransaction()
eVisibleRegion = 0x00000002,
- eRestartTransaction = 0x00000008
};
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index 4ee176c..eb0983a 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -594,12 +594,6 @@
const uint32_t flags = layer->doTransaction(0);
if (flags & Layer::eVisibleRegion)
mVisibleRegionsDirty = true;
-
- if (flags & Layer::eRestartTransaction) {
- // restart the transaction, but back-off a little
- layer->setTransactionFlags(eTransactionNeeded);
- setTransactionFlags(eTraversalNeeded, ms2ns(8));
- }
}
}
@@ -1131,7 +1125,14 @@
// take effect before returning.
Mutex::Autolock _l(mStateLock);
while (mResizeTransationPending) {
- mTransactionCV.wait(mStateLock);
+ status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
+ if (CC_UNLIKELY(err != NO_ERROR)) {
+ // just in case something goes wrong in SF, return to the
+ // called after a few seconds.
+ LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
+ mResizeTransationPending = false;
+ break;
+ }
}
}
}
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index 2535094..adb3174 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -107,7 +107,7 @@
} else {
k = key;
}
- if (true) {
+ if (false) {
LOGD("Writing entity: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(),
dataSize);
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index fb5e4e6..bb9206c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -51,7 +51,7 @@
*/
public class SettingsBackupAgent extends BackupHelperAgent {
// STOPSHIP: set DEBUG to false
- private static final boolean DEBUG = true;
+ private static final boolean DEBUG = false;
private static final String KEY_SYSTEM = "system";
private static final String KEY_SECURE = "secure";
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 3c46954..f8b8ecc 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -816,7 +816,10 @@
temp.delete();
}
- writeStateToFileLocked(temp);
+ if (!writeStateToFileLocked(temp)) {
+ Log.w(TAG, "Failed to persist new settings");
+ return;
+ }
//noinspection ResultOfMethodCallIgnored
real.delete();
@@ -824,7 +827,7 @@
temp.renameTo(real);
}
- void writeStateToFileLocked(File file) {
+ boolean writeStateToFileLocked(File file) {
FileOutputStream stream = null;
int N;
@@ -877,6 +880,7 @@
out.endDocument();
stream.close();
+ return true;
} catch (IOException e) {
try {
if (stream != null) {
@@ -889,6 +893,7 @@
//noinspection ResultOfMethodCallIgnored
file.delete();
}
+ return false;
}
}
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index ef0cbee..e722eb1 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -205,11 +205,9 @@
File mDataDir;
File mJournalDir;
File mJournal;
- RandomAccessFile mJournalStream;
// Keep a log of all the apps we've ever backed up
private File mEverStored;
- private RandomAccessFile mEverStoredStream;
HashSet<String> mEverStoredApps = new HashSet<String>();
// Persistently track the need to do a full init
@@ -257,7 +255,7 @@
// Set up the backup-request journaling
mJournalDir = new File(mBaseStateDir, "pending");
mJournalDir.mkdirs(); // creates mBaseStateDir along the way
- makeJournalLocked(); // okay because no other threads are running yet
+ mJournal = null; // will be created on first use
// Set up the various sorts of package tracking we do
initPackageTracking();
@@ -369,56 +367,51 @@
// this log, we sanity-check its contents here and reconstruct it.
mEverStored = new File(mBaseStateDir, "processed");
File tempProcessedFile = new File(mBaseStateDir, "processed.new");
- try {
- // If there are previous contents, parse them out then start a new
- // file to continue the recordkeeping.
- if (mEverStored.exists()) {
- RandomAccessFile temp = new RandomAccessFile(tempProcessedFile, "rw");
- mEverStoredStream = new RandomAccessFile(mEverStored, "r");
-
- // parse its existing contents
- mEverStoredStream.seek(0);
- temp.seek(0);
- try {
- while (true) {
- PackageInfo info;
- String pkg = mEverStoredStream.readUTF();
- try {
- info = mPackageManager.getPackageInfo(pkg, 0);
- mEverStoredApps.add(pkg);
- temp.writeUTF(pkg);
- if (DEBUG) Log.v(TAG, " + " + pkg);
- } catch (NameNotFoundException e) {
- // nope, this package was uninstalled; don't include it
- if (DEBUG) Log.v(TAG, " - " + pkg);
- }
- }
- } catch (EOFException e) {
- // now we're at EOF
- }
-
- // Once we've rewritten the backup history log, atomically replace the
- // old one with the new one then reopen the file for continuing use.
- temp.close();
- mEverStoredStream.close();
- tempProcessedFile.renameTo(mEverStored);
- }
- // This will create the file if it doesn't exist
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- mEverStoredStream.seek(mEverStoredStream.length());
- } catch (IOException e) {
- Log.e(TAG, "Unable to open known-stored file!");
- mEverStoredStream = null;
- }
// If we were in the middle of removing something from the ever-backed-up
// file, there might be a transient "processed.new" file still present.
- // We've reconstructed a coherent state at this point though, so we can
- // safely discard that file now.
+ // Ignore it -- we'll validate "processed" against the current package set.
if (tempProcessedFile.exists()) {
tempProcessedFile.delete();
}
+ // If there are previous contents, parse them out then start a new
+ // file to continue the recordkeeping.
+ if (mEverStored.exists()) {
+ RandomAccessFile temp = null;
+ RandomAccessFile in = null;
+
+ try {
+ temp = new RandomAccessFile(tempProcessedFile, "rws");
+ in = new RandomAccessFile(mEverStored, "r");
+
+ while (true) {
+ PackageInfo info;
+ String pkg = in.readUTF();
+ try {
+ info = mPackageManager.getPackageInfo(pkg, 0);
+ mEverStoredApps.add(pkg);
+ temp.writeUTF(pkg);
+ if (DEBUG) Log.v(TAG, " + " + pkg);
+ } catch (NameNotFoundException e) {
+ // nope, this package was uninstalled; don't include it
+ if (DEBUG) Log.v(TAG, " - " + pkg);
+ }
+ }
+ } catch (EOFException e) {
+ // Once we've rewritten the backup history log, atomically replace the
+ // old one with the new one then reopen the file for continuing use.
+ if (!tempProcessedFile.renameTo(mEverStored)) {
+ Log.e(TAG, "Error renaming " + tempProcessedFile + " to " + mEverStored);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Error in processed file", e);
+ } finally {
+ try { if (temp != null) temp.close(); } catch (IOException e) {}
+ try { if (in != null) in.close(); } catch (IOException e) {}
+ }
+ }
+
// Register for broadcasts about package install, etc., so we can
// update the provider list.
IntentFilter filter = new IntentFilter();
@@ -428,41 +421,29 @@
mContext.registerReceiver(mBroadcastReceiver, filter);
}
- private void makeJournalLocked() {
- try {
- mJournal = File.createTempFile("journal", null, mJournalDir);
- mJournalStream = new RandomAccessFile(mJournal, "rwd");
- } catch (IOException e) {
- Log.e(TAG, "Unable to write backup journals");
- mJournal = null;
- mJournalStream = null;
- }
- }
-
private void parseLeftoverJournals() {
- if (mJournal != null) {
- File[] allJournals = mJournalDir.listFiles();
- for (File f : allJournals) {
- if (f.compareTo(mJournal) != 0) {
- // This isn't the current journal, so it must be a leftover. Read
- // out the package names mentioned there and schedule them for
- // backup.
- try {
- Log.i(TAG, "Found stale backup journal, scheduling:");
- RandomAccessFile in = new RandomAccessFile(f, "r");
- while (true) {
- String packageName = in.readUTF();
- Log.i(TAG, " + " + packageName);
- dataChanged(packageName);
- }
- } catch (EOFException e) {
- // no more data; we're done
- } catch (Exception e) {
- // can't read it or other error; just skip it
- } finally {
- // close/delete the file
- f.delete();
+ for (File f : mJournalDir.listFiles()) {
+ if (mJournal == null || f.compareTo(mJournal) != 0) {
+ // This isn't the current journal, so it must be a leftover. Read
+ // out the package names mentioned there and schedule them for
+ // backup.
+ RandomAccessFile in = null;
+ try {
+ Log.i(TAG, "Found stale backup journal, scheduling:");
+ in = new RandomAccessFile(f, "r");
+ while (true) {
+ String packageName = in.readUTF();
+ Log.i(TAG, " + " + packageName);
+ dataChanged(packageName);
}
+ } catch (EOFException e) {
+ // no more data; we're done
+ } catch (Exception e) {
+ Log.e(TAG, "Can't read " + f, e);
+ } finally {
+ // close/delete the file
+ try { if (in != null) in.close(); } catch (IOException e) {}
+ f.delete();
}
}
}
@@ -505,19 +486,8 @@
void resetBackupState(File stateFileDir) {
synchronized (mQueueLock) {
// Wipe the "what we've ever backed up" tracking
- try {
- // close the ever-stored journal...
- if (mEverStoredStream != null) {
- mEverStoredStream.close();
- }
- // ... so we can delete it and start over
- mEverStored.delete();
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- } catch (IOException e) {
- Log.e(TAG, "Unable to open known-stored file!");
- mEverStoredStream = null;
- }
mEverStoredApps.clear();
+ mEverStored.delete();
// Remove all the state files
for (File sf : stateFileDir.listFiles()) {
@@ -533,11 +503,7 @@
int uid = mBackupParticipants.keyAt(i);
HashSet<ApplicationInfo> participants = mBackupParticipants.valueAt(i);
for (ApplicationInfo app: participants) {
- try {
- dataChanged(app.packageName);
- } catch (RemoteException e) {
- // can't happen; we're in the same process
- }
+ dataChanged(app.packageName);
}
}
}
@@ -652,7 +618,6 @@
// snapshot the pending-backup set and work on that
ArrayList<BackupRequest> queue = new ArrayList<BackupRequest>();
- File oldJournal = mJournal;
synchronized (mQueueLock) {
// Do we have any work to do?
if (mPendingBackups.size() > 0) {
@@ -663,14 +628,8 @@
mPendingBackups.clear();
// Start a new backup-queue journal file too
- if (mJournalStream != null) {
- try {
- mJournalStream.close();
- } catch (IOException e) {
- // don't need to do anything
- }
- makeJournalLocked();
- }
+ File oldJournal = mJournal;
+ mJournal = null;
// At this point, we have started a new journal file, and the old
// file identity is being passed to the backup processing thread.
@@ -763,11 +722,7 @@
if (!mEverStoredApps.contains(pkg.packageName)) {
if (DEBUG) Log.i(TAG, "New app " + pkg.packageName
+ " never backed up; scheduling");
- try {
- dataChanged(pkg.packageName);
- } catch (RemoteException e) {
- // can't happen; it's a local method call
- }
+ dataChanged(pkg.packageName);
}
}
}
@@ -871,58 +826,57 @@
// Called from the backup thread: record that the given app has been successfully
// backed up at least once
void logBackupComplete(String packageName) {
- if (mEverStoredStream != null && !packageName.equals(PACKAGE_MANAGER_SENTINEL)) {
- synchronized (mEverStoredApps) {
- if (mEverStoredApps.add(packageName)) {
- try {
- mEverStoredStream.writeUTF(packageName);
- } catch (IOException e) {
- Log.e(TAG, "Unable to log backup of " + packageName + ", ceasing log");
- try {
- mEverStoredStream.close();
- } catch (IOException ioe) {
- // we're dropping it; no need to handle an exception on close here
- }
- mEverStoredStream = null;
- }
- }
+ if (packageName.equals(PACKAGE_MANAGER_SENTINEL)) return;
+
+ synchronized (mEverStoredApps) {
+ if (!mEverStoredApps.add(packageName)) return;
+
+ RandomAccessFile out = null;
+ try {
+ out = new RandomAccessFile(mEverStored, "rws");
+ out.seek(out.length());
+ out.writeUTF(packageName);
+ } catch (IOException e) {
+ Log.e(TAG, "Can't log backup of " + packageName + " to " + mEverStored);
+ } finally {
+ try { if (out != null) out.close(); } catch (IOException e) {}
}
}
}
// Remove our awareness of having ever backed up the given package
void removeEverBackedUp(String packageName) {
- if (DEBUG) Log.v(TAG, "Removing backed-up knowledge of " + packageName
- + ", new set:");
+ if (DEBUG) Log.v(TAG, "Removing backed-up knowledge of " + packageName + ", new set:");
- if (mEverStoredStream != null) {
- synchronized (mEverStoredApps) {
- // Rewrite the file and rename to overwrite. If we reboot in the middle,
- // we'll recognize on initialization time that the package no longer
- // exists and fix it up then.
- File tempKnownFile = new File(mBaseStateDir, "processed.new");
- try {
- mEverStoredStream.close();
- RandomAccessFile known = new RandomAccessFile(tempKnownFile, "rw");
- mEverStoredApps.remove(packageName);
- for (String s : mEverStoredApps) {
- known.writeUTF(s);
- if (DEBUG) Log.v(TAG, " " + s);
- }
- known.close();
- tempKnownFile.renameTo(mEverStored);
- mEverStoredStream = new RandomAccessFile(mEverStored, "rwd");
- } catch (IOException e) {
- // Bad: we couldn't create the new copy. For safety's sake we
- // abandon the whole process and remove all what's-backed-up
- // state entirely, meaning we'll force a backup pass for every
- // participant on the next boot or [re]install.
- Log.w(TAG, "Error rewriting backed-up set; halting log");
- mEverStoredStream = null;
- mEverStoredApps.clear();
- tempKnownFile.delete();
- mEverStored.delete();
+ synchronized (mEverStoredApps) {
+ // Rewrite the file and rename to overwrite. If we reboot in the middle,
+ // we'll recognize on initialization time that the package no longer
+ // exists and fix it up then.
+ File tempKnownFile = new File(mBaseStateDir, "processed.new");
+ RandomAccessFile known = null;
+ try {
+ known = new RandomAccessFile(tempKnownFile, "rws");
+ mEverStoredApps.remove(packageName);
+ for (String s : mEverStoredApps) {
+ known.writeUTF(s);
+ if (DEBUG) Log.v(TAG, " " + s);
}
+ known.close();
+ known = null;
+ if (!tempKnownFile.renameTo(mEverStored)) {
+ throw new IOException("Can't rename " + tempKnownFile + " to " + mEverStored);
+ }
+ } catch (IOException e) {
+ // Bad: we couldn't create the new copy. For safety's sake we
+ // abandon the whole process and remove all what's-backed-up
+ // state entirely, meaning we'll force a backup pass for every
+ // participant on the next boot or [re]install.
+ Log.w(TAG, "Error rewriting " + mEverStored, e);
+ mEverStoredApps.clear();
+ tempKnownFile.delete();
+ mEverStored.delete();
+ } finally {
+ try { if (known != null) known.close(); } catch (IOException e) {}
}
}
}
@@ -1018,8 +972,7 @@
}
class ClearDataObserver extends IPackageDataObserver.Stub {
- public void onRemoveCompleted(String packageName, boolean succeeded)
- throws RemoteException {
+ public void onRemoveCompleted(String packageName, boolean succeeded) {
synchronized(mClearDataLock) {
mClearingData = false;
mClearDataLock.notifyAll();
@@ -1061,9 +1014,11 @@
try {
EventLog.writeEvent(BACKUP_START_EVENT, mTransport.transportDirName());
- // If we haven't stored anything yet, we need to do an init operation.
- if (status == BackupConstants.TRANSPORT_OK && mEverStoredApps.size() == 0) {
- Log.i(TAG, "Initializing (wiping) backup transport storage");
+ // If we haven't stored package manager metadata yet, we must init the transport.
+ File pmState = new File(mStateDir, PACKAGE_MANAGER_SENTINEL);
+ if (status == BackupConstants.TRANSPORT_OK && pmState.length() <= 0) {
+ Log.i(TAG, "Initializing (wiping) backup state and transport storage");
+ resetBackupState(mStateDir); // Just to make sure.
status = mTransport.initializeDevice();
if (status == BackupConstants.TRANSPORT_OK) {
EventLog.writeEvent(BACKUP_INITIALIZE_EVENT);
@@ -1107,10 +1062,9 @@
if (status == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
// The backend reports that our dataset has been wiped. We need to
// reset all of our bookkeeping and instead run a new backup pass for
- // everything.
+ // everything. This must come after mBackupOrRestoreInProgress is cleared.
EventLog.writeEvent(BACKUP_RESET_EVENT, mTransport.transportDirName());
resetBackupState(mStateDir);
- backupNow();
}
} catch (Exception e) {
Log.e(TAG, "Error in backup thread", e);
@@ -1123,11 +1077,7 @@
if (status != BackupConstants.TRANSPORT_OK) {
Log.w(TAG, "Backup pass unsuccessful, restaging");
for (BackupRequest req : mQueue) {
- try {
- dataChanged(req.appInfo.packageName);
- } catch (RemoteException e) {
- // can't happen; it's a local call
- }
+ dataChanged(req.appInfo.packageName);
}
// We also want to reset the backup schedule based on whatever
@@ -1141,7 +1091,7 @@
// this pass's journal any more; or it failed, in which case we just
// re-enqueued all of these packages in the current active journal.
// Either way, we no longer need this pass's journal.
- if (!mJournal.delete()) {
+ if (mJournal != null && !mJournal.delete()) {
Log.e(TAG, "Unable to remove backup journal file " + mJournal);
}
@@ -1150,6 +1100,12 @@
synchronized (mQueueLock) {
mBackupOrRestoreInProgress = false;
}
+
+ if (status == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
+ // This must come after mBackupOrRestoreInProgress is cleared.
+ backupNow();
+ }
+
mWakelock.release();
}
}
@@ -1782,7 +1738,7 @@
// ----- IBackupManager binder interface -----
- public void dataChanged(String packageName) throws RemoteException {
+ public void dataChanged(String packageName) {
// Record that we need a backup pass for the caller. Since multiple callers
// may share a uid, we need to note all candidates within that uid and schedule
// a backup pass for each of them.
@@ -1840,14 +1796,17 @@
}
private void writeToJournalLocked(String str) {
- if (mJournalStream != null) {
- try {
- mJournalStream.writeUTF(str);
- } catch (IOException e) {
- Log.e(TAG, "Error writing to backup journal");
- mJournalStream = null;
- mJournal = null;
- }
+ RandomAccessFile out = null;
+ try {
+ if (mJournal == null) mJournal = File.createTempFile("journal", null, mJournalDir);
+ out = new RandomAccessFile(mJournal, "rws");
+ out.seek(out.length());
+ out.writeUTF(str);
+ } catch (IOException e) {
+ Log.e(TAG, "Can't write " + str + " to backup journal", e);
+ mJournal = null;
+ } finally {
+ try { if (out != null) out.close(); } catch (IOException e) {}
}
}
@@ -1902,7 +1861,7 @@
// Run a backup pass immediately for any applications that have declared
// that they have pending updates.
- public void backupNow() throws RemoteException {
+ public void backupNow() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "backupNow");
if (DEBUG) Log.v(TAG, "Scheduling immediate backup pass");
@@ -2210,8 +2169,16 @@
pw.println("Available transports:");
for (String t : listAllTransports()) {
- String pad = (t.equals(mCurrentTransport)) ? " * " : " ";
- pw.println(pad + t);
+ pw.println((t.equals(mCurrentTransport) ? " * " : " ") + t);
+ try {
+ File dir = new File(mBaseStateDir, getTransport(t).transportDirName());
+ for (File f : dir.listFiles()) {
+ pw.println(" " + f.getName() + " - " + f.length() + " state bytes");
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error in transportDirName()", e);
+ pw.println(" Error: " + e);
+ }
}
pw.println("Pending init: " + mPendingInits.size());
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index f85d931..204389e 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -313,7 +313,7 @@
setMediaStorageNotification(
com.android.internal.R.string.ext_media_safe_unmount_notification_title,
com.android.internal.R.string.ext_media_safe_unmount_notification_message,
- com.android.internal.R.drawable.stat_notify_sim_toolkit,
+ com.android.internal.R.drawable.stat_notify_sdcard,
true, true, null);
mShowSafeUnmountNotificationWhenUnmounted = false;
} else {
@@ -333,7 +333,7 @@
setMediaStorageNotification(
com.android.internal.R.string.ext_media_checking_notification_title,
com.android.internal.R.string.ext_media_checking_notification_message,
- com.android.internal.R.drawable.stat_notify_sim_toolkit,
+ com.android.internal.R.drawable.stat_notify_sdcard_prepare,
true, false, null);
updateUsbMassStorageNotification(true, false);
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 867f215..5eb78c3 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -178,6 +178,7 @@
final File mFrameworkDir;
final File mSystemAppDir;
final File mAppInstallDir;
+ final File mDalvikCacheDir;
// Directory containing the private parts (e.g. code and non-resource assets) of forward-locked
// apps.
@@ -438,8 +439,11 @@
final HashSet<String> libFiles = new HashSet<String>();
mFrameworkDir = new File(Environment.getRootDirectory(), "framework");
+ mDalvikCacheDir = new File(dataDir, "dalvik-cache");
if (mInstaller != null) {
+ boolean didDexOpt = false;
+
/**
* Out of paranoia, ensure that everything in the boot class
* path has been dexed.
@@ -452,6 +456,7 @@
if (dalvik.system.DexFile.isDexOptNeeded(paths[i])) {
libFiles.add(paths[i]);
mInstaller.dexopt(paths[i], Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Boot class path not found: " + paths[i]);
@@ -474,6 +479,7 @@
if (dalvik.system.DexFile.isDexOptNeeded(lib)) {
libFiles.add(lib);
mInstaller.dexopt(lib, Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Library not found: " + lib);
@@ -493,7 +499,7 @@
* run from a non-root shell.
*/
String[] frameworkFiles = mFrameworkDir.list();
- if (frameworkFiles != null && mInstaller != null) {
+ if (frameworkFiles != null) {
for (int i=0; i<frameworkFiles.length; i++) {
File libPath = new File(mFrameworkDir, frameworkFiles[i]);
String path = libPath.getPath();
@@ -508,6 +514,7 @@
try {
if (dalvik.system.DexFile.isDexOptNeeded(path)) {
mInstaller.dexopt(path, Process.SYSTEM_UID, true);
+ didDexOpt = true;
}
} catch (FileNotFoundException e) {
Log.w(TAG, "Jar not found: " + path);
@@ -516,6 +523,25 @@
}
}
}
+
+ if (didDexOpt) {
+ // If we had to do a dexopt of one of the previous
+ // things, then something on the system has changed.
+ // Consider this significant, and wipe away all other
+ // existing dexopt files to ensure we don't leave any
+ // dangling around.
+ String[] files = mDalvikCacheDir.list();
+ if (files != null) {
+ for (int i=0; i<files.length; i++) {
+ String fn = files[i];
+ if (fn.startsWith("data@app@")
+ || fn.startsWith("data@app-private@")) {
+ Log.i(TAG, "Pruning dalvik file: " + fn);
+ (new File(mDalvikCacheDir, fn)).delete();
+ }
+ }
+ }
+ }
}
mFrameworkInstallObserver = new AppDirObserver(
@@ -641,6 +667,27 @@
final File permFile = new File(Environment.getRootDirectory(),
"etc/permissions/platform.xml");
readPermissionsFromXml(permFile);
+
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("Libs:");
+ Iterator<String> it = mSharedLibraries.keySet().iterator();
+ while (it.hasNext()) {
+ sb.append(' ');
+ String name = it.next();
+ sb.append(name);
+ sb.append(':');
+ sb.append(mSharedLibraries.get(name));
+ }
+ Log.i(TAG, sb.toString());
+
+ sb.setLength(0);
+ sb.append("Features:");
+ it = mAvailableFeatures.keySet().iterator();
+ while (it.hasNext()) {
+ sb.append(' ');
+ sb.append(it.next());
+ }
+ Log.i(TAG, sb.toString());
}
private void readPermissionsFromXml(File permFile) {
@@ -730,7 +777,7 @@
Log.w(TAG, "<library> without file at "
+ parser.getPositionDescription());
} else {
- Log.i(TAG, "Got library " + lname + " in " + lfile);
+ //Log.i(TAG, "Got library " + lname + " in " + lfile);
mSharedLibraries.put(lname, lfile);
}
XmlUtils.skipCurrentTag(parser);
@@ -742,7 +789,7 @@
Log.w(TAG, "<feature> without name at "
+ parser.getPositionDescription());
} else {
- Log.i(TAG, "Got feature " + fname);
+ //Log.i(TAG, "Got feature " + fname);
FeatureInfo fi = new FeatureInfo();
fi.name = fname;
mAvailableFeatures.put(fname, fi);
@@ -1974,27 +2021,25 @@
}
if ((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
// Check for updated system applications here
- if (updatedPkg != null) {
- if ((ps != null) && (!ps.codePath.getPath().equals(scanFile.getPath()))) {
- if (pkg.mVersionCode <= ps.versionCode) {
- // The system package has been updated and the code path does not match
- // Ignore entry. Just return
- Log.w(TAG, "Package:" + pkg.packageName +
- " has been updated. Ignoring the one from path:"+scanFile);
- mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
- return null;
- } else {
- // Delete the older apk pointed to by ps
- // At this point, its safely assumed that package installation for
- // apps in system partition will go through. If not there won't be a working
- // version of the app
- synchronized (mPackages) {
- // Just remove the loaded entries from package lists.
- mPackages.remove(ps.name);
- }
- deletePackageResourcesLI(ps.name, ps.codePathString, ps.resourcePathString);
- mSettings.enableSystemPackageLP(ps.name);
+ if ((ps != null) && (!ps.codePath.equals(scanFile))) {
+ if (pkg.mVersionCode < ps.versionCode) {
+ // The system package has been updated and the code path does not match
+ // Ignore entry. Just return
+ Log.w(TAG, "Package:" + pkg.packageName +
+ " has been updated. Ignoring the one from path:"+scanFile);
+ mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
+ return null;
+ } else {
+ // Delete the older apk pointed to by ps
+ // At this point, its safely assumed that package installation for
+ // apps in system partition will go through. If not there won't be a working
+ // version of the app
+ synchronized (mPackages) {
+ // Just remove the loaded entries from package lists.
+ mPackages.remove(ps.name);
}
+ deletePackageResourcesLI(ps.name, ps.codePathString, ps.resourcePathString);
+ mSettings.enableSystemPackageLP(ps.name);
}
}
}
@@ -2004,7 +2049,7 @@
scanMode |= SCAN_FORWARD_LOCKED;
}
File resFile = destResourceFile;
- if ((scanMode & SCAN_FORWARD_LOCKED) != 0) {
+ if (ps != null && ((scanMode & SCAN_FORWARD_LOCKED) != 0)) {
resFile = getFwdLockedResource(ps.name);
}
// Note that we invoke the following method only if we are about to unpack an application
@@ -3814,14 +3859,13 @@
final ApplicationInfo deletedPackageAppInfo = deletedPackage.applicationInfo;
final ApplicationInfo installedPackageAppInfo =
newPackage.applicationInfo;
- if (!deletedPackageAppInfo.sourceDir
- .equals(installedPackageAppInfo.sourceDir)) {
- new File(deletedPackageAppInfo.sourceDir).delete();
- }
- if (!deletedPackageAppInfo.publicSourceDir
- .equals(installedPackageAppInfo.publicSourceDir)) {
- new File(deletedPackageAppInfo.publicSourceDir).delete();
- }
+ deletePackageResourcesLI(pkgName,
+ !deletedPackageAppInfo.sourceDir
+ .equals(installedPackageAppInfo.sourceDir)
+ ? deletedPackageAppInfo.sourceDir : null,
+ !deletedPackageAppInfo.publicSourceDir
+ .equals(installedPackageAppInfo.publicSourceDir)
+ ? deletedPackageAppInfo.publicSourceDir : null);
//update signature on the new package setting
//this should always succeed, since we checked the
//signature earlier.
@@ -4504,22 +4548,30 @@
private void deletePackageResourcesLI(String packageName,
String sourceDir, String publicSourceDir) {
- File sourceFile = new File(sourceDir);
- if (!sourceFile.exists()) {
- Log.w(TAG, "Package source " + sourceDir + " does not exist.");
+ if (sourceDir != null) {
+ File sourceFile = new File(sourceDir);
+ if (!sourceFile.exists()) {
+ Log.w(TAG, "Package source " + sourceDir + " does not exist.");
+ }
+ // Delete application's code and resources
+ sourceFile.delete();
+ if (mInstaller != null) {
+ int retCode = mInstaller.rmdex(sourceFile.toString());
+ if (retCode < 0) {
+ Log.w(TAG, "Couldn't remove dex file for package: "
+ + packageName + " at location "
+ + sourceFile.toString() + ", retcode=" + retCode);
+ // we don't consider this to be a failure of the core package deletion
+ }
+ }
}
- // Delete application's code and resources
- sourceFile.delete();
- final File publicSourceFile = new File(publicSourceDir);
- if (publicSourceFile.exists()) {
- publicSourceFile.delete();
- }
- if (mInstaller != null) {
- int retCode = mInstaller.rmdex(sourceFile.toString());
- if (retCode < 0) {
- Log.w(TAG, "Couldn't remove dex file for package: "
- + packageName + " at location " + sourceFile.toString() + ", retcode=" + retCode);
- // we don't consider this to be a failure of the core package deletion
+ if (publicSourceDir != null && !publicSourceDir.equals(sourceDir)) {
+ final File publicSourceFile = new File(publicSourceDir);
+ if (!publicSourceFile.exists()) {
+ Log.w(TAG, "Package public source " + publicSourceFile + " does not exist.");
+ }
+ if (publicSourceFile.exists()) {
+ publicSourceFile.delete();
}
}
}
@@ -5725,7 +5777,7 @@
}
static class GrantedPermissions {
- final int pkgFlags;
+ int pkgFlags;
HashSet<String> grantedPermissions = new HashSet<String>();
int[] gids;
@@ -6143,10 +6195,10 @@
// Let the app continue with previous uid if code path changes.
reportSettingsProblem(Log.WARN,
"Package " + name + " codePath changed from " + p.codePath
- + " to " + codePath + "; Retaining data and using new code from " +
- codePath);
+ + " to " + codePath + "; Retaining data and using new");
}
- } else if (p.sharedUser != sharedUser) {
+ }
+ if (p.sharedUser != sharedUser) {
reportSettingsProblem(Log.WARN,
"Package " + name + " shared user changed from "
+ (p.sharedUser != null ? p.sharedUser.name : "<nothing>")
@@ -6154,6 +6206,13 @@
+ (sharedUser != null ? sharedUser.name : "<nothing>")
+ "; replacing with new");
p = null;
+ } else {
+ if ((pkgFlags&ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // If what we are scanning is a system package, then
+ // make it so, regardless of whether it was previously
+ // installed only in the data partition.
+ p.pkgFlags |= ApplicationInfo.FLAG_SYSTEM;
+ }
}
}
if (p == null) {
@@ -6214,14 +6273,14 @@
// Update code path if needed
if (!codePath.toString().equalsIgnoreCase(p.codePathString)) {
Log.w(TAG, "Code path for pkg : " + p.pkg.packageName +
- " changing form " + p.codePathString + " to " + codePath);
+ " changing from " + p.codePathString + " to " + codePath);
p.codePath = codePath;
p.codePathString = codePath.toString();
}
//Update resource path if needed
if (!resourcePath.toString().equalsIgnoreCase(p.resourcePathString)) {
Log.w(TAG, "Resource path for pkg : " + p.pkg.packageName +
- " changing form " + p.resourcePathString + " to " + resourcePath);
+ " changing from " + p.resourcePathString + " to " + resourcePath);
p.resourcePath = resourcePath;
p.resourcePathString = resourcePath.toString();
}
@@ -6470,15 +6529,19 @@
|FileUtils.S_IRGRP|FileUtils.S_IWGRP
|FileUtils.S_IROTH,
-1, -1);
+ return;
} catch(XmlPullParserException e) {
Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
-
} catch(java.io.IOException e) {
Log.w(TAG, "Unable to write package manager settings, current changes will be lost at reboot", e);
-
}
-
+ // Clean up partially written file
+ if (mSettingsFilename.exists()) {
+ if (!mSettingsFilename.delete()) {
+ Log.i(TAG, "Failed to clean up mangled file: " + mSettingsFilename);
+ }
+ }
//Debug.stopMethodTracing();
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 84ed3ed..e5b6720 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -233,8 +233,8 @@
mPolicy.enableKeyguard(false);
}
public void released() {
+ mPolicy.enableKeyguard(true);
synchronized (mKeyguardDisabled) {
- mPolicy.enableKeyguard(true);
mWaitingUntilKeyguardReenabled = false;
mKeyguardDisabled.notifyAll();
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d917d17..c62444d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -140,7 +140,8 @@
static final boolean DEBUG_PROVIDER = localLOGV || false;
static final boolean DEBUG_USER_LEAVING = localLOGV || false;
static final boolean DEBUG_RESULTS = localLOGV || false;
- static final boolean DEBUG_BACKUP = localLOGV || true;
+ static final boolean DEBUG_BACKUP = localLOGV || false;
+ static final boolean DEBUG_CONFIGURATION = localLOGV || false;
static final boolean VALIDATE_TOKENS = false;
static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -2251,7 +2252,7 @@
mHandler.sendMessage(msg);
}
- reportResumedActivity(next);
+ reportResumedActivityLocked(next);
next.thumbnail = null;
setFocusedActivityLocked(next);
@@ -2524,7 +2525,7 @@
}
}
- private void reportResumedActivity(HistoryRecord r) {
+ private void reportResumedActivityLocked(HistoryRecord r) {
//Log.i(TAG, "**** REPORT RESUME: " + r);
final int identHash = System.identityHashCode(r);
@@ -5295,6 +5296,8 @@
if (app.instrumentationClass != null) {
ensurePackageDexOpt(app.instrumentationClass.getPackageName());
}
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Binding proc "
+ + processName + " with config " + mConfiguration);
thread.bindApplication(processName, app.instrumentationInfo != null
? app.instrumentationInfo : app.info, providers,
app.instrumentationClass, app.instrumentationProfileFile,
@@ -8326,6 +8329,7 @@
// This happens before any activities are started, so we can
// change mConfiguration in-place.
mConfiguration.updateFrom(configuration);
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Initial config: " + mConfiguration);
}
}
@@ -10336,9 +10340,11 @@
try {
if (DEBUG_SERVICE) Log.v(TAG, "Scheduling start service: "
+ r.name + " " + r.intent);
+ mStringBuilder.setLength(0);
+ r.intent.getIntent().toShortString(mStringBuilder, false, true);
EventLog.writeEvent(LOG_AM_CREATE_SERVICE,
System.identityHashCode(r), r.shortName,
- r.intent.getIntent().toString(), r.app.pid);
+ mStringBuilder.toString(), r.app.pid);
synchronized (r.stats.getBatteryStats()) {
r.stats.startLaunchedLocked();
}
@@ -11368,8 +11374,7 @@
try {
proc.thread.scheduleCreateBackupAgent(app, backupMode);
} catch (RemoteException e) {
- // !!! TODO: notify the backup manager that we crashed, or rely on
- // death notices, or...?
+ // Will time out on the backup manager side
}
} else {
if (DEBUG_BACKUP) Log.v(TAG, "Agent proc not running, waiting for attach");
@@ -12713,7 +12718,7 @@
Configuration newConfig = new Configuration(mConfiguration);
changes = newConfig.updateFrom(values);
if (changes != 0) {
- if (DEBUG_SWITCH) {
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
Log.i(TAG, "Updating configuration to: " + values);
}
@@ -12737,6 +12742,8 @@
ProcessRecord app = mLRUProcesses.get(i);
try {
if (app.thread != null) {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending to proc "
+ + app.processName + " new config " + mConfiguration);
app.thread.scheduleConfigurationChanged(mConfiguration);
}
} catch (Exception e) {
@@ -12806,6 +12813,7 @@
if (andResume) {
r.results = null;
r.newIntents = null;
+ reportResumedActivityLocked(r);
}
return true;
@@ -12820,19 +12828,21 @@
*/
private final boolean ensureActivityConfigurationLocked(HistoryRecord r,
int globalChanges) {
- if (DEBUG_SWITCH) Log.i(TAG, "Ensuring correct configuration: " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Ensuring correct configuration: " + r);
// Short circuit: if the two configurations are the exact same
// object (the common case), then there is nothing to do.
Configuration newConfig = mConfiguration;
if (r.configuration == newConfig) {
- if (DEBUG_SWITCH) Log.i(TAG, "Configuration unchanged in " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Configuration unchanged in " + r);
return true;
}
// We don't worry about activities that are finishing.
if (r.finishing) {
- if (DEBUG_SWITCH) Log.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
"Configuration doesn't matter in finishing " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -12846,7 +12856,7 @@
// If the activity isn't currently running, just leave the new
// configuration and it will pick that up next time it starts.
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH) Log.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
"Configuration doesn't matter not running " + r);
r.stopFreezingScreenLocked(false);
return true;
@@ -12858,22 +12868,26 @@
// Figure out what has changed between the two configurations.
int changes = oldConfig.diff(newConfig);
- if (DEBUG_SWITCH) {
- Log.i(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) {
+ Log.v(TAG, "Checking to restart " + r.info.name + ": changed=0x"
+ Integer.toHexString(changes) + ", handles=0x"
- + Integer.toHexString(r.info.configChanges));
+ + Integer.toHexString(r.info.configChanges)
+ + ", newConfig=" + newConfig);
}
if ((changes&(~r.info.configChanges)) != 0) {
// Aha, the activity isn't handling the change, so DIE DIE DIE.
r.configChangeFlags |= changes;
r.startFreezingScreenLocked(r.app, globalChanges);
if (r.app == null || r.app.thread == null) {
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is destroying non-running " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is destroying non-running " + r);
destroyActivityLocked(r, true);
} else if (r.state == ActivityState.PAUSING) {
// A little annoying: we are waiting for this activity to
// finish pausing. Let's not do anything now, but just
// flag that it needs to be restarted when done pausing.
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is skipping already pausing " + r);
r.configDestroy = true;
return true;
} else if (r.state == ActivityState.RESUMED) {
@@ -12881,11 +12895,13 @@
// and we need to restart the top, resumed activity.
// Instead of doing the normal handshaking, just say
// "restart!".
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is restarting resumed " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is restarting resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, true);
r.configChangeFlags = 0;
} else {
- if (DEBUG_SWITCH) Log.i(TAG, "Switch is restarting non-resumed " + r);
+ if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Log.v(TAG,
+ "Switch is restarting non-resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, false);
r.configChangeFlags = 0;
}
@@ -12903,6 +12919,7 @@
// it last got.
if (r.app != null && r.app.thread != null) {
try {
+ if (DEBUG_CONFIGURATION) Log.v(TAG, "Sending new config to " + r);
r.app.thread.scheduleActivityConfigurationChanged(r);
} catch (RemoteException e) {
// If process died, whatever.
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java
index 66868a3..373b44e 100644
--- a/services/java/com/android/server/am/UsageStatsService.java
+++ b/services/java/com/android/server/am/UsageStatsService.java
@@ -381,7 +381,10 @@
mFileLeaf = getCurrentDateStr(FILE_PREFIX);
// Copy current file to back up
File backupFile = new File(mFile.getPath() + ".bak");
- mFile.renameTo(backupFile);
+ if (!mFile.renameTo(backupFile)) {
+ Log.w(TAG, "Failed to persist new stats");
+ return;
+ }
try {
// Write mStats to file
writeStatsFLOCK();
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 1f0e5a5..52c8b1f 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -100,6 +100,7 @@
public static final int EVENT_CLEAN_UP_CONNECTION = 34;
protected static final int EVENT_CDMA_OTA_PROVISION = 35;
protected static final int EVENT_RESTART_RADIO = 36;
+ protected static final int EVENT_SET_MASTER_DATA_ENABLE = 37;
/***** Constants *****/
@@ -111,8 +112,11 @@
protected static final int APN_HIPRI_ID = 4;
protected static final int APN_NUM_TYPES = 5;
- protected static final int APN_DISABLED = 0;
- protected static final int APN_ENABLED = 1;
+ protected static final int DISABLED = 0;
+ protected static final int ENABLED = 1;
+
+ // responds to the setDataEnabled call - used independently from the APN requests
+ protected boolean mMasterDataEnabled = true;
protected boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
protected int enabledCount = 0;
@@ -322,6 +326,11 @@
onCleanUpConnection(tearDown, (String)msg.obj);
break;
+ case EVENT_SET_MASTER_DATA_ENABLE:
+ boolean enabled = (msg.arg1 == ENABLED) ? true : false;
+ onSetDataEnabled(enabled);
+ break;
+
default:
Log.e("DATA", "Unidentified event = " + msg.what);
break;
@@ -486,7 +495,7 @@
Message msg = obtainMessage(EVENT_ENABLE_NEW_APN);
msg.arg1 = id;
- msg.arg2 = (enable ? APN_ENABLED : APN_DISABLED);
+ msg.arg2 = (enable ? ENABLED : DISABLED);
sendMessage(msg);
}
@@ -497,7 +506,7 @@
", enabledCount = " + enabledCount +
", isApnTypeActive = " + isApnTypeActive(apnIdToType(apnId)));
}
- if (enabled == APN_ENABLED) {
+ if (enabled == ENABLED) {
if (!dataEnabled[apnId]) {
dataEnabled[apnId] = true;
enabledCount++;
@@ -545,8 +554,24 @@
*/
public boolean setDataEnabled(boolean enable) {
if (DBG) Log.d(LOG_TAG, "setDataEnabled(" + enable + ")");
- setEnabled(APN_DEFAULT_ID, enable);
+
+ Message msg = obtainMessage(EVENT_SET_MASTER_DATA_ENABLE);
+ msg.arg1 = (enable ? ENABLED : DISABLED);
+ sendMessage(msg);
return true;
}
+ protected void onSetDataEnabled(boolean enable) {
+ if (mMasterDataEnabled != enable) {
+ mMasterDataEnabled = enable;
+ if (enable) {
+ mRetryMgr.resetRetryCount();
+ onTrySetupData(Phone.REASON_DATA_ENABLED);
+ } else {
+ onCleanUpConnection(true, Phone.REASON_DATA_DISABLED);
+ }
+ }
+ }
+
+
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index 9fe2038..1005d20 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -1039,8 +1039,8 @@
private void disableDataCallInEmergencyCall(String dialString) {
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
if (Phone.DEBUG_PHONE) log("disableDataCallInEmergencyCall");
- phone.disableDataConnectivity();
mIsInEmergencyCall = true;
+ phone.disableDataConnectivity();
}
}
@@ -1050,15 +1050,16 @@
*/
private void checkAndEnableDataCallAfterEmergencyCallDropped() {
if (mIsInEmergencyCall) {
+ mIsInEmergencyCall = false;
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
if (Phone.DEBUG_PHONE) {
log("checkAndEnableDataCallAfterEmergencyCallDropped,inEcm=" + inEcm);
}
if (inEcm.compareTo("false") == 0) {
// Re-initiate data connection
+ // TODO - can this be changed to phone.enableDataConnectivity();
phone.mDataConnection.setDataEnabled(true);
}
- mIsInEmergencyCall = false;
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index d0a9337..c695dd7 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -302,7 +302,7 @@
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) && mMasterDataEnabled;
}
private boolean trySetupData(String reason) {
@@ -347,7 +347,8 @@
" roaming=" + roaming +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" desiredPowerState=" + desiredPowerState +
- " PendingRestartRadio=" + mPendingRestartRadio);
+ " PendingRestartRadio=" + mPendingRestartRadio +
+ " MasterDataEnabled=" + mMasterDataEnabled);
}
return false;
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 5bdf09f..ffd6dd3 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -391,7 +391,8 @@
private boolean isDataAllowed() {
boolean roaming = phone.getServiceState().getRoaming();
- return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled());
+ return getAnyDataEnabled() && (!roaming || getDataOnRoamingEnabled()) &&
+ mMasterDataEnabled;
}
//****** Called from ServiceStateTracker
@@ -475,7 +476,8 @@
" roaming=" + phone.getServiceState().getRoaming() +
" dataOnRoamingEnable=" + getDataOnRoamingEnabled() +
" ps restricted=" + mIsPsRestricted +
- " desiredPowerState=" + desiredPowerState);
+ " desiredPowerState=" + desiredPowerState +
+ " MasterDataEnabled=" + mMasterDataEnabled);
return false;
}
}
@@ -1039,7 +1041,7 @@
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
// if no more retries on a secondary APN attempt, tell the world and revert.
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
return;
}
if (mReregisterOnReconnectFailure) {
@@ -1203,7 +1205,7 @@
notifyNoData(cause);
if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
phone.notifyDataConnection(Phone.REASON_APN_FAILED);
- onEnableApn(apnTypeToId(mRequestedApnType), APN_DISABLED);
+ onEnableApn(apnTypeToId(mRequestedApnType), DISABLED);
}
return;
}