Merge change 8817 into donut
* changes:
fix [2017532] Partial Update leaves residual image.
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index ba6cc32..3aeac53 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -1085,6 +1085,14 @@
reply.writeInt(result);
return true;
}
+ case KILL_APPLICATION_WITH_UID_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ String pkg = data.readString();
+ int uid = data.readInt();
+ killApplicationWithUid(pkg, uid);
+ reply.writeNoException();
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -2368,6 +2376,17 @@
data.recycle();
return result;
}
+ public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeString(pkg);
+ data.writeInt(uid);
+ mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
private IBinder mRemote;
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 182843a..32a2891 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3634,7 +3634,7 @@
Locale.setDefault(config.locale);
}
- Resources.updateSystemConfiguration(config, null);
+ Resources.updateSystemConfiguration(config, dm);
ApplicationContext.ApplicationPackageManager.configurationChanged();
//Log.i(TAG, "Configuration changed in " + currentPackageName());
@@ -3753,6 +3753,14 @@
data.info = getPackageInfoNoCheck(data.appInfo);
+ /**
+ * Switch this process to density compatibility mode if needed.
+ */
+ if ((data.appInfo.flags&ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES)
+ == 0) {
+ Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
+ }
+
if (data.debugMode != IApplicationThread.DEBUG_OFF) {
// XXX should have option to change the port.
Debug.changeDebugPort(8100);
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 95b376c..b1b5282 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -266,6 +266,8 @@
Intent intent, String resolvedType, IBinder resultTo,
String resultWho, int requestCode, boolean onlyIfNeeded)
throws RemoteException;
+
+ public void killApplicationWithUid(String pkg, int uid) throws RemoteException;
/*
* Private non-Binder interfaces
@@ -421,4 +423,5 @@
int REGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92;
int UNREGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93;
int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94;
+ int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95;
}
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index dd70130..dd24a75 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -244,7 +244,12 @@
}
return success;
}
-
+
+ private boolean isInRealAppSearch() {
+ return !mGlobalSearchMode
+ && (mPreviousComponents == null || mPreviousComponents.isEmpty());
+ }
+
/**
* Called in response to a press of the hard search button in
* {@link #onKeyDown(int, KeyEvent)}, this method toggles between in-app
@@ -535,7 +540,7 @@
// we dismiss the entire dialog instead
mSearchAutoComplete.setDropDownDismissedOnCompletion(false);
- if (mGlobalSearchMode) {
+ if (!isInRealAppSearch()) {
mSearchAutoComplete.setDropDownAlwaysVisible(true); // fill space until results come in
} else {
mSearchAutoComplete.setDropDownAlwaysVisible(false);
@@ -1259,10 +1264,13 @@
launchGlobalSearchIntent(intent);
} else {
getContext().startActivity(intent);
- // in global search mode, SearchDialogWrapper#performActivityResuming
+ // If the search switches to a different activity,
+ // SearchDialogWrapper#performActivityResuming
// will handle hiding the dialog when the next activity starts, but for
- // in-app search, we still need to dismiss the dialog.
- dismiss();
+ // real in-app search, we still need to dismiss the dialog.
+ if (isInRealAppSearch()) {
+ dismiss();
+ }
}
} catch (RuntimeException ex) {
Log.e(LOG_TAG, "Failed launch activity: " + intent, ex);
@@ -1401,13 +1409,13 @@
return;
}
if (DBG) Log.d(LOG_TAG, "Switching to " + componentName);
-
- ComponentName previous = mLaunchComponent;
+
+ pushPreviousComponent(mLaunchComponent);
if (!show(componentName, mAppSearchData, false)) {
Log.w(LOG_TAG, "Failed to switch to source " + componentName);
+ popPreviousComponent();
return;
}
- pushPreviousComponent(previous);
String query = intent.getStringExtra(SearchManager.QUERY);
setUserQuery(query);
@@ -1701,6 +1709,12 @@
if (mSearchDialog.backToPreviousComponent()) {
return true;
}
+ // If the drop-down obscures the keyboard, the user wouldn't see anything
+ // happening when pressing back, so we dismiss the entire dialog instead.
+ if (isInputMethodNotNeeded()) {
+ mSearchDialog.cancel();
+ return true;
+ }
return false; // will dismiss soft keyboard if necessary
}
return false;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index fcf946f..6936435 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -545,7 +545,6 @@
private ZoomButtonsController mZoomButtonsController;
private ImageView mZoomOverviewButton;
- private ImageView mZoomFitPageButton;
// These keep track of the center point of the zoom. They are used to
// determine the point around which we should zoom.
@@ -617,6 +616,16 @@
// Create the buttons controller
mZoomButtonsController = new ZoomButtonsController(this);
mZoomButtonsController.setOnZoomListener(mZoomListener);
+ // ZoomButtonsController positions the buttons at the bottom, but in
+ // the middle. Change their layout parameters so they appear on the
+ // right.
+ View controls = mZoomButtonsController.getZoomControls();
+ ViewGroup.LayoutParams params = controls.getLayoutParams();
+ if (params instanceof FrameLayout.LayoutParams) {
+ FrameLayout.LayoutParams frameParams = (FrameLayout.LayoutParams)
+ params;
+ frameParams.gravity = Gravity.RIGHT;
+ }
// Create the accessory buttons
LayoutInflater inflater =
@@ -636,15 +645,6 @@
}
}
});
- mZoomFitPageButton =
- (ImageView) container.findViewById(com.android.internal.R.id.zoom_fit_page);
- mZoomFitPageButton.setOnClickListener(
- new View.OnClickListener() {
- public void onClick(View v) {
- zoomWithPreview(mDefaultScale);
- updateZoomButtonsEnabled();
- }
- });
}
private void updateZoomButtonsEnabled() {
@@ -654,17 +654,14 @@
// Hide the zoom in and out buttons, as well as the fit to page
// button, if the page cannot zoom
mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
- mZoomFitPageButton.setVisibility(View.GONE);
} else {
// Bring back the hidden zoom controls.
mZoomButtonsController.getZoomControls()
.setVisibility(View.VISIBLE);
- mZoomFitPageButton.setVisibility(View.VISIBLE);
// Set each one individually, as a page may be able to zoom in
// or out.
mZoomButtonsController.setZoomInEnabled(canZoomIn);
mZoomButtonsController.setZoomOutEnabled(canZoomOut);
- mZoomFitPageButton.setEnabled(mActualScale != mDefaultScale);
}
mZoomOverviewButton.setVisibility(canZoomScrollOut() ? View.VISIBLE:
View.GONE);
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 6848a55..a998072 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -209,8 +209,7 @@
private void onClickImpl() {
// If the dropdown is showing, bring it back in front of the soft
// keyboard when the user touches the text field.
- if (mPopup.isShowing() &&
- mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED) {
+ if (mPopup.isShowing() && isInputMethodNotNeeded()) {
ensureImeVisible();
}
}
@@ -1103,6 +1102,13 @@
}
/**
+ * @hide internal used only here and SearchDialog
+ */
+ public boolean isInputMethodNotNeeded() {
+ return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
+ }
+
+ /**
* <p>Displays the drop down on screen.</p>
*/
public void showDropDown() {
@@ -1111,7 +1117,7 @@
int widthSpec = 0;
int heightSpec = 0;
- boolean noInputMethod = mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
+ boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.FILL_PARENT) {
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 24c0e2a..e19a93d 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -432,7 +432,7 @@
width = resolveSize(width, widthMeasureSpec);
if (offsetHorizontalAxis) {
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
LayoutParams params = (LayoutParams) child.getLayoutParams();
@@ -486,10 +486,14 @@
View child = getChildAt(i);
if (child.getVisibility() != GONE && child != ignore) {
LayoutParams params = (LayoutParams) child.getLayoutParams();
- params.mLeft += horizontalOffset;
- params.mRight += horizontalOffset;
- params.mTop += verticalOffset;
- params.mBottom += verticalOffset;
+ if (horizontalGravity) {
+ params.mLeft += horizontalOffset;
+ params.mRight += horizontalOffset;
+ }
+ if (verticalGravity) {
+ params.mTop += verticalOffset;
+ params.mBottom += verticalOffset;
+ }
}
}
}
diff --git a/core/res/res/drawable/expander_ic_maximized.9.png b/core/res/res/drawable/expander_ic_maximized.9.png
index 778255a..465cabd 100644
--- a/core/res/res/drawable/expander_ic_maximized.9.png
+++ b/core/res/res/drawable/expander_ic_maximized.9.png
Binary files differ
diff --git a/core/res/res/drawable/expander_ic_minimized.9.png b/core/res/res/drawable/expander_ic_minimized.9.png
index 5235c18..9967ecb 100644
--- a/core/res/res/drawable/expander_ic_minimized.9.png
+++ b/core/res/res/drawable/expander_ic_minimized.9.png
Binary files differ
diff --git a/core/res/res/drawable/rate_star_small_half.png b/core/res/res/drawable/rate_star_small_half.png
index a81449b..437a11c 100644
--- a/core/res/res/drawable/rate_star_small_half.png
+++ b/core/res/res/drawable/rate_star_small_half.png
Binary files differ
diff --git a/core/res/res/drawable/rate_star_small_off.png b/core/res/res/drawable/rate_star_small_off.png
index 618766f..6fb0a36 100644
--- a/core/res/res/drawable/rate_star_small_off.png
+++ b/core/res/res/drawable/rate_star_small_off.png
Binary files differ
diff --git a/core/res/res/drawable/rate_star_small_on.png b/core/res/res/drawable/rate_star_small_on.png
index 74e3280..5392361 100644
--- a/core/res/res/drawable/rate_star_small_on.png
+++ b/core/res/res/drawable/rate_star_small_on.png
Binary files differ
diff --git a/core/res/res/layout/zoom_browser_accessory_buttons.xml b/core/res/res/layout/zoom_browser_accessory_buttons.xml
index 4bf2bdf..69afca9 100644
--- a/core/res/res/layout/zoom_browser_accessory_buttons.xml
+++ b/core/res/res/layout/zoom_browser_accessory_buttons.xml
@@ -18,18 +18,11 @@
*/
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <ImageView android:id="@+id/zoom_fit_page"
- android:background="@android:drawable/btn_browser_zoom_fit_page"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|left"
- android:layout_marginLeft="7dip"
- />
<ImageView android:id="@+id/zoom_page_overview"
android:background="@android:drawable/btn_browser_zoom_page_overview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|right"
- android:layout_marginRight="7dip"
+ android:layout_gravity="bottom|left"
+ android:layout_marginLeft="7dip"
/>
</merge>
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index bb19229..eef1096 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -46,10 +46,29 @@
private boolean mRecycled;
// Package-scoped for fast access.
- /*package*/ int mDensity = DENSITY_NONE;
+ /*package*/ int mDensity = sDefaultDensity = getDefaultDensity();
private static volatile Matrix sScaleMatrix;
+ private static volatile int sDefaultDensity = -1;
+
+ /**
+ * For backwards compatibility, allows the app layer to change the default
+ * density when running old apps.
+ * @hide
+ */
+ public static void setDefaultDensity(int density) {
+ sDefaultDensity = density;
+ }
+
+ /*package*/ static int getDefaultDensity() {
+ if (sDefaultDensity >= 0) {
+ return sDefaultDensity;
+ }
+ sDefaultDensity = DisplayMetrics.DENSITY_DEVICE;
+ return sDefaultDensity;
+ }
+
/**
* @noinspection UnusedDeclaration
*/
@@ -72,9 +91,16 @@
/**
* <p>Returns the density for this bitmap.</p>
*
- * <p>The default density scale is {@link #DENSITY_NONE}.</p>
+ * <p>The default density is the same density as the current display,
+ * unless the current application does not support different screen
+ * densities in which case it is
+ * {@link android.util.DisplayMetrics#DENSITY_DEFAULT}. Note that
+ * compatibility mode is determined by the application that was initially
+ * loaded into a process -- applications that share the same process should
+ * all have the same compatibility, or ensure they explicitly set the
+ * density of their bitmaps appropriately.</p>
*
- * @return A scaling factor of the default density (160) or {@link #DENSITY_NONE}
+ * @return A scaling factor of the default density or {@link #DENSITY_NONE}
* if the scaling factor is unknown.
*
* @see #setDensity(int)
@@ -272,7 +298,8 @@
* Tries to make a new bitmap based on the dimensions of this bitmap,
* setting the new bitmap's config to the one specified, and then copying
* this bitmap's pixels into the new bitmap. If the conversion is not
- * supported, or the allocator fails, then this returns NULL.
+ * supported, or the allocator fails, then this returns NULL. The returned
+ * bitmap initially has the same density as the original.
*
* @param config The desired config for the resulting bitmap
* @param isMutable True if the resulting bitmap should be mutable (i.e.
@@ -281,7 +308,11 @@
*/
public Bitmap copy(Config config, boolean isMutable) {
checkRecycled("Can't copy a recycled bitmap");
- return nativeCopy(mNativeBitmap, config.nativeInt, isMutable);
+ Bitmap b = nativeCopy(mNativeBitmap, config.nativeInt, isMutable);
+ if (b != null) {
+ b.mDensity = mDensity;
+ }
+ return b;
}
public static Bitmap createScaledBitmap(Bitmap src, int dstWidth,
@@ -316,7 +347,8 @@
/**
* Returns an immutable bitmap from the source bitmap. The new bitmap may
- * be the same object as source, or a copy may have been made.
+ * be the same object as source, or a copy may have been made. It is
+ * initialized with the same density as the original bitmap.
*/
public static Bitmap createBitmap(Bitmap src) {
return createBitmap(src, 0, 0, src.getWidth(), src.getHeight());
@@ -325,7 +357,8 @@
/**
* Returns an immutable bitmap from the specified subset of the source
* bitmap. The new bitmap may be the same object as source, or a copy may
- * have been made.
+ * have been made. It is
+ * initialized with the same density as the original bitmap.
*
* @param source The bitmap we are subsetting
* @param x The x coordinate of the first pixel in source
@@ -339,7 +372,8 @@
/**
* Returns an immutable bitmap from subset of the source bitmap,
- * transformed by the optional matrix.
+ * transformed by the optional matrix. It is
+ * initialized with the same density as the original bitmap.
*
* @param source The bitmap we are subsetting
* @param x The x coordinate of the first pixel in source
@@ -406,18 +440,20 @@
paint.setAntiAlias(true);
}
}
- canvas.setBitmap(bitmap);
- canvas.drawBitmap(source, srcR, dstR, paint);
-
+
// The new bitmap was created from a known bitmap source so assume that
// they use the same density
bitmap.mDensity = source.mDensity;
+
+ canvas.setBitmap(bitmap);
+ canvas.drawBitmap(source, srcR, dstR, paint);
return bitmap;
}
/**
- * Returns a mutable bitmap with the specified width and height.
+ * Returns a mutable bitmap with the specified width and height. Its
+ * initial density is as per {@link #getDensity}.
*
* @param width The width of the bitmap
* @param height The height of the bitmap
@@ -432,7 +468,8 @@
/**
* Returns a immutable bitmap with the specified width and height, with each
- * pixel value set to the corresponding value in the colors array.
+ * pixel value set to the corresponding value in the colors array. Its
+ * initial density is as per {@link #getDensity}.
*
* @param colors Array of {@link Color} used to initialize the pixels.
* @param offset Number of values to skip before the first color in the
@@ -466,7 +503,8 @@
/**
* Returns a immutable bitmap with the specified width and height, with each
- * pixel value set to the corresponding value in the colors array.
+ * pixel value set to the corresponding value in the colors array. Its
+ * initial density is as per {@link #getDensity}.
*
* @param colors Array of {@link Color} used to initialize the pixels.
* This array must be at least as large as width * height.
@@ -882,6 +920,9 @@
* -2, -2, so that drawing the alpha bitmap offset by (-2, -2) and then
* drawing the original would result in the blur visually aligning with
* the original.
+ *
+ * <p>The initial density of the returned bitmap is the same as the original's.
+ *
* @param paint Optional paint used to modify the alpha values in the
* resulting bitmap. Pass null for default behavior.
* @param offsetXY Optional array that returns the X (index 0) and Y
@@ -899,6 +940,7 @@
if (bm == null) {
throw new RuntimeException("Failed to extractAlpha on Bitmap");
}
+ bm.mDensity = mDensity;
return bm;
}
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 8ecbfbd..bc2e42e 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -49,7 +49,7 @@
private DrawFilter mDrawFilter;
// Package-scoped for quick access.
- /*package*/ int mDensity = DisplayMetrics.DENSITY_DEFAULT;
+ /*package*/ int mDensity = Bitmap.DENSITY_NONE;
// Used by native code
@SuppressWarnings({"UnusedDeclaration"})
@@ -57,7 +57,9 @@
/**
* Construct an empty raster canvas. Use setBitmap() to specify a bitmap to
- * draw into.
+ * draw into. The initial target density is {@link Bitmap#DENSITY_NONE};
+ * this will typically be replaced when a target bitmap is set for the
+ * canvas.
*/
public Canvas() {
// 0 means no native bitmap
@@ -67,6 +69,9 @@
/**
* Construct a canvas with the specified bitmap to draw into. The bitmap
* must be mutable.
+ *
+ * <p>The initial target density of the canvas is the same as the given
+ * bitmap's density.
*
* @param bitmap Specifies a mutable bitmap for the canvas to draw into.
*/
@@ -78,9 +83,7 @@
throwIfRecycled(bitmap);
mNativeCanvas = initRaster(bitmap.ni());
mBitmap = bitmap;
- final int density = bitmap.mDensity;
- mDensity = density == Bitmap.DENSITY_NONE
- ? DisplayMetrics.DENSITY_DEFAULT : density;
+ mDensity = bitmap.mDensity;
}
/*package*/ Canvas(int nativeCanvas) {
@@ -88,6 +91,7 @@
throw new IllegalStateException();
}
mNativeCanvas = nativeCanvas;
+ mDensity = Bitmap.getDefaultDensity();
}
/**
@@ -96,10 +100,14 @@
* be supported in this mode (e.g. some GL implementations may not support
* antialiasing or certain effects like ColorMatrix or certain Xfermodes).
* However, no exception will be thrown in those cases.
+ *
+ * <p>The initial target density of the canvas is the same as the initial
+ * density of bitmaps as per {@link Bitmap#getDensity() Bitmap.getDensity()}.
*/
public Canvas(GL gl) {
mNativeCanvas = initGL();
mGL = gl;
+ mDensity = Bitmap.getDefaultDensity();
}
/**
@@ -120,9 +128,13 @@
}
/**
- * Specify a bitmap for the canvas to draw into.
+ * Specify a bitmap for the canvas to draw into. As a side-effect, also
+ * updates the canvas's target density to match that of the bitmap.
*
* @param bitmap Specifies a mutable bitmap for the canvas to draw into.
+ *
+ * @see #setDensity(int)
+ * @see #getDensity()
*/
public void setBitmap(Bitmap bitmap) {
if (!bitmap.isMutable()) {
@@ -135,9 +147,7 @@
native_setBitmap(mNativeCanvas, bitmap.ni());
mBitmap = bitmap;
- final int density = bitmap.mDensity;
- mDensity = density == Bitmap.DENSITY_NONE
- ? DisplayMetrics.DENSITY_DEFAULT : density;
+ mDensity = bitmap.mDensity;
}
/**
@@ -176,12 +186,12 @@
public native int getHeight();
/**
- * <p>Returns the density for this Canvas' backing bitmap.</p>
+ * <p>Returns the target density of the canvas. The default density is
+ * derived from the density of its backing bitmap, or
+ * {@link Bitmap#DENSITY_NONE} if there is not one.</p>
*
- * <p>The default density scale is {@link Bitmap#DENSITY_NONE}.</p>
- *
- * @return A scaling factor of the default density (160dpi) or
- * {@link Bitmap#DENSITY_NONE} if the scaling factor is unknown.
+ * @return Returns the current target density of the canvas, which is used
+ * to determine the scaling factor when drawing a bitmap into it.
*
* @see #setDensity(int)
* @see Bitmap#getDensity()
@@ -191,10 +201,13 @@
}
/**
- * <p>Specifies the density for this Canvas' backing bitmap.
+ * <p>Specifies the density for this Canvas' backing bitmap. This modifies
+ * the target density of the canvas itself, as well as the density of its
+ * backing bitmap via {@link Bitmap#setDensity(int) Bitmap.setDensity(int)}.
*
- * @param density The density scaling factor to use with this bitmap or
- * {@link Bitmap#DENSITY_NONE} if the factor is unknown.
+ * @param density The new target density of the canvas, which is used
+ * to determine the scaling factor when drawing a bitmap into it. Use
+ * {@link Bitmap#DENSITY_NONE} to disable bitmap scaling.
*
* @see #getDensity()
* @see Bitmap#setDensity(int)
diff --git a/keystore/jni/certtool.c b/keystore/jni/certtool.c
index 1ae8dab..b36b34a 100644
--- a/keystore/jni/certtool.c
+++ b/keystore/jni/certtool.c
@@ -30,13 +30,17 @@
android_security_CertTool_generateCertificateRequest(JNIEnv* env,
jobject thiz,
jint bits,
- jstring subject)
+ jstring jChallenge)
{
+ int ret = -1;
+ jboolean bIsCopy;
char csr[REPLY_MAX];
- if (gen_csr(bits, subject, csr) == 0) {
- return (*env)->NewStringUTF(env, csr);
- }
+ const char* challenge = (*env)->GetStringUTFChars(env, jChallenge, &bIsCopy);
+
+ ret = gen_csr(bits, challenge , csr);
+ (*env)->ReleaseStringUTFChars(env, jChallenge, challenge);
+ if (ret == 0) return (*env)->NewStringUTF(env, csr);
return NULL;
}
diff --git a/packages/SettingsProvider/res/values-cs/defaults.xml b/packages/SettingsProvider/res/values-cs/defaults.xml
deleted file mode 100644
index a7c01b3..0000000
--- a/packages/SettingsProvider/res/values-cs/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"mobil,bluetooth,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-cs/strings.xml b/packages/SettingsProvider/res/values-cs/strings.xml
index dc75a92..2b089d9 100644
--- a/packages/SettingsProvider/res/values-cs/strings.xml
+++ b/packages/SettingsProvider/res/values-cs/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Paměť pro nastavení"</string>
+ <string name="app_label" msgid="4567566098528588863">"Paměť pro nastavení"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-de/defaults.xml b/packages/SettingsProvider/res/values-de/defaults.xml
deleted file mode 100644
index f85d3f0..0000000
--- a/packages/SettingsProvider/res/values-de/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"Mobilfunk, Bluetooth, WLAN"</string>
- <string name="def_location_providers_allowed">"GPS"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-de/strings.xml b/packages/SettingsProvider/res/values-de/strings.xml
index 50c8a14..a293522 100644
--- a/packages/SettingsProvider/res/values-de/strings.xml
+++ b/packages/SettingsProvider/res/values-de/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Einstellungsspeicher"</string>
+ <string name="app_label" msgid="4567566098528588863">"Einstellungsspeicher"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-es/defaults.xml b/packages/SettingsProvider/res/values-es/defaults.xml
deleted file mode 100644
index a64805a..0000000
--- a/packages/SettingsProvider/res/values-es/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"móvil,bluetooth,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-es/strings.xml b/packages/SettingsProvider/res/values-es/strings.xml
index d30d195..de3958b 100644
--- a/packages/SettingsProvider/res/values-es/strings.xml
+++ b/packages/SettingsProvider/res/values-es/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Almacenamiento de configuración"</string>
+ <string name="app_label" msgid="4567566098528588863">"Almacenamiento de configuración"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-fr/defaults.xml b/packages/SettingsProvider/res/values-fr/defaults.xml
deleted file mode 100644
index 56334cc..0000000
--- a/packages/SettingsProvider/res/values-fr/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"cellulaire, Bluetooth, Wi-Fi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-fr/strings.xml b/packages/SettingsProvider/res/values-fr/strings.xml
index 686ec8b..7a1386a 100644
--- a/packages/SettingsProvider/res/values-fr/strings.xml
+++ b/packages/SettingsProvider/res/values-fr/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Stockage des paramètres"</string>
+ <string name="app_label" msgid="4567566098528588863">"Stockage des paramètres"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-it/defaults.xml b/packages/SettingsProvider/res/values-it/defaults.xml
deleted file mode 100644
index 19c0896..0000000
--- a/packages/SettingsProvider/res/values-it/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"cellulare,bluetooth,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-it/strings.xml b/packages/SettingsProvider/res/values-it/strings.xml
index 29e462f..f88a654 100644
--- a/packages/SettingsProvider/res/values-it/strings.xml
+++ b/packages/SettingsProvider/res/values-it/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Archiviazione impostazioni"</string>
+ <string name="app_label" msgid="4567566098528588863">"Archiviazione impostazioni"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-nl/defaults.xml b/packages/SettingsProvider/res/values-nl/defaults.xml
deleted file mode 100644
index 625235a..0000000
--- a/packages/SettingsProvider/res/values-nl/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"mobiel,bluetooth,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-nl/strings.xml b/packages/SettingsProvider/res/values-nl/strings.xml
index b37b535..7a0e416 100644
--- a/packages/SettingsProvider/res/values-nl/strings.xml
+++ b/packages/SettingsProvider/res/values-nl/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Opslagruimte voor instellingen"</string>
+ <string name="app_label" msgid="4567566098528588863">"Opslagruimte voor instellingen"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-pl/defaults.xml b/packages/SettingsProvider/res/values-pl/defaults.xml
deleted file mode 100644
index b60832e..0000000
--- a/packages/SettingsProvider/res/values-pl/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"komórka,bluetooth,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-pl/strings.xml b/packages/SettingsProvider/res/values-pl/strings.xml
index 4ab1e91..ccff82e3 100644
--- a/packages/SettingsProvider/res/values-pl/strings.xml
+++ b/packages/SettingsProvider/res/values-pl/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"Pamięć ustawień"</string>
+ <string name="app_label" msgid="4567566098528588863">"Pamięć ustawień"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values-zh-rTW/defaults.xml b/packages/SettingsProvider/res/values-zh-rTW/defaults.xml
deleted file mode 100644
index fdbba88..0000000
--- a/packages/SettingsProvider/res/values-zh-rTW/defaults.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="def_airplane_mode_radios">"手機,藍牙,wifi"</string>
- <string name="def_location_providers_allowed">"gps"</string>
- <!-- no translation found for def_backup_transport (6764822064303377157) -->
- <skip />
-</resources>
diff --git a/packages/SettingsProvider/res/values-zh-rTW/strings.xml b/packages/SettingsProvider/res/values-zh-rTW/strings.xml
index b24144a..0700a76 100644
--- a/packages/SettingsProvider/res/values-zh-rTW/strings.xml
+++ b/packages/SettingsProvider/res/values-zh-rTW/strings.xml
@@ -15,5 +15,5 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_label">"設定儲存空間"</string>
+ <string name="app_label" msgid="4567566098528588863">"設定儲存空間"</string>
</resources>
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index f8adaa1..f60ea57 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -21,7 +21,7 @@
<integer name="def_screen_off_timeout">60000</integer>
<bool name="def_airplane_mode_on">false</bool>
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
- <string name="def_airplane_mode_radios">cell,bluetooth,wifi</string>
+ <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi</string>
<bool name="def_auto_time">true</bool>
<bool name="def_accelerometer_rotation">true</bool>
<!-- Default screen brightness, from 0 to 255. 102 is 40%. -->
@@ -35,7 +35,7 @@
Network location is off by default because it requires
user opt-in via Setup Wizard or Settings.
-->
- <string name="def_location_providers_allowed">gps</string>
+ <string name="def_location_providers_allowed" translatable="false">gps</string>
<!-- 0 == mobile, 1 == wifi. -->
<integer name="def_network_preference">1</integer>
<bool name="def_usb_mass_storage_enabled">true</bool>
@@ -43,5 +43,5 @@
<bool name="def_networks_available_notification_on">true</bool>
<bool name="def_backup_enabled">false</bool>
- <string name="def_backup_transport"></string>
+ <string name="def_backup_transport" translatable="false"></string>
</resources>
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index e52ba80..6832862 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -109,7 +109,9 @@
mFilename = file;
}
}
-
+ // If the speech queue is locked for more than 5 seconds, something has gone
+ // very wrong with processSpeechQueue.
+ private static final int SPEECHQUEUELOCK_TIMEOUT = 5000;
private static final int MAX_SPEECH_ITEM_CHAR_LENGTH = 4000;
private static final int MAX_FILENAME_LENGTH = 250;
// TODO use the TTS stream type when available
@@ -389,9 +391,8 @@
int result = TextToSpeech.TTS_ERROR;
boolean speechQueueAvailable = false;
try{
- // If the queue is locked for more than 1 second,
- // something has gone very wrong with processSpeechQueue.
- speechQueueAvailable = speechQueueLock.tryLock(1000, TimeUnit.MILLISECONDS);
+ speechQueueAvailable =
+ speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT, TimeUnit.MILLISECONDS);
if (speechQueueAvailable) {
Log.i("TtsService", "Stopping");
for (int i = mSpeechQueue.size() - 1; i > -1; i--){
@@ -439,9 +440,8 @@
int result = TextToSpeech.TTS_ERROR;
boolean speechQueueAvailable = false;
try{
- // If the queue is locked for more than 1 second,
- // something has gone very wrong with processSpeechQueue.
- speechQueueAvailable = speechQueueLock.tryLock(1000, TimeUnit.MILLISECONDS);
+ speechQueueAvailable =
+ speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT, TimeUnit.MILLISECONDS);
if (speechQueueAvailable) {
for (int i = mSpeechQueue.size() - 1; i > -1; i--){
if (mSpeechQueue.get(i).mType != SpeechItem.TEXT_TO_FILE){
@@ -752,8 +752,10 @@
private void processSpeechQueue() {
boolean speechQueueAvailable = false;
try {
- speechQueueAvailable = speechQueueLock.tryLock();
+ speechQueueAvailable =
+ speechQueueLock.tryLock(SPEECHQUEUELOCK_TIMEOUT, TimeUnit.MILLISECONDS);
if (!speechQueueAvailable) {
+ Log.e("TtsService", "processSpeechQueue - Speech queue is unavailable.");
return;
}
if (mSpeechQueue.size() < 1) {
@@ -822,6 +824,9 @@
if (mSpeechQueue.size() > 0) {
mSpeechQueue.remove(0);
}
+ } catch (InterruptedException e) {
+ Log.e("TtsService", "TTS processSpeechQueue: tryLock interrupted");
+ e.printStackTrace();
} finally {
// This check is needed because finally will always run; even if the
// method returns somewhere in the try block.
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 4afa03e..b39f2f6 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -60,7 +60,6 @@
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
-import android.os.Debug;
import android.os.HandlerThread;
import android.os.Parcel;
import android.os.RemoteException;
@@ -1826,6 +1825,11 @@
ps = mSettings.peekPackageLP(pkg.packageName);
updatedPkg = mSettings.mDisabledSysPackages.get(pkg.packageName);
}
+ // Verify certificates first
+ if (!collectCertificatesLI(pp, ps, pkg, scanFile, parseFlags)) {
+ Log.i(TAG, "Failed verifying certificates for package:" + pkg.packageName);
+ return null;
+ }
if (updatedPkg != null) {
// An updated system app will not have the PARSE_IS_SYSTEM flag set initially
parseFlags |= PackageParser.PARSE_IS_SYSTEM;
@@ -1843,16 +1847,19 @@
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 (!collectCertificatesLI(pp, ps, pkg, scanFile, parseFlags)) {
- Log.i(TAG, "Failed verifying certificates for package:" + pkg.packageName);
- return null;
- }
// The apk is forward locked (not public) if its code and resources
// are kept in different files.
if (ps != null && !ps.codePath.equals(ps.resourcePath)) {
@@ -2132,7 +2139,7 @@
pkg.applicationInfo.packageName,
pkg.applicationInfo.processName,
pkg.applicationInfo.uid);
- pkg.applicationInfo.publicSourceDir = pkgSetting.resourcePathString;
+ pkg.applicationInfo.publicSourceDir = destResourceFile.toString();
File dataPath;
if (mPlatformPackage == pkg) {
@@ -2259,15 +2266,26 @@
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_FACTORY_TEST;
}
+ // We don't expect installation to fail beyond this point,
if ((scanMode&SCAN_MONITOR) != 0) {
pkg.mPath = destCodeFile.getAbsolutePath();
mAppDirs.put(pkg.mPath, pkg);
}
+ // Request the ActivityManager to kill the process(only for existing packages)
+ // so that we do not end up in a confused state while the user is still using the older
+ // version of the application while the new one gets installed.
+ IActivityManager am = ActivityManagerNative.getDefault();
+ if ((am != null) && ((parseFlags & PackageManager.INSTALL_REPLACE_EXISTING ) != 0)) {
+ try {
+ am.killApplicationWithUid(pkg.applicationInfo.packageName,
+ pkg.applicationInfo.uid);
+ } catch (RemoteException e) {
+ }
+ }
synchronized (mPackages) {
- // We don't expect installation to fail beyond this point
// Add the new setting to mSettings
- mSettings.insertPackageSettingLP(pkgSetting, pkg.packageName, suid);
+ mSettings.insertPackageSettingLP(pkgSetting, pkg, destCodeFile, destResourceFile);
// Add the new setting to mPackages
mPackages.put(pkg.applicationInfo.packageName, pkg);
int N = pkg.providers.size();
@@ -2955,7 +2973,8 @@
}
if ((addedPermission || replace) && !ps.permissionsFixed &&
- (ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) {
+ ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) ||
+ ((ps.pkgFlags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0)){
// This is the first that we have heard about this package, so the
// permissions we have now selected are fixed until explicitly
// changed.
@@ -4156,7 +4175,9 @@
private void removePackageDataLI(PackageParser.Package p, PackageRemovedInfo outInfo,
int flags) {
String packageName = p.packageName;
- outInfo.removedPackage = packageName;
+ if (outInfo != null) {
+ outInfo.removedPackage = packageName;
+ }
removePackageLI(p, true);
// Retrieve object to delete permissions for shared user later on
PackageSetting deletedPs;
@@ -4178,7 +4199,9 @@
dataDir.delete();
}
synchronized (mPackages) {
- outInfo.removedUid = mSettings.removePackageLP(packageName);
+ if (outInfo != null) {
+ outInfo.removedUid = mSettings.removePackageLP(packageName);
+ }
}
}
synchronized (mPackages) {
@@ -4253,7 +4276,7 @@
}
return true;
}
-
+
private void deletePackageResourcesLI(String packageName,
String sourceDir, String publicSourceDir) {
File sourceFile = new File(sourceDir);
@@ -4283,7 +4306,9 @@
Log.w(TAG, "Package " + p.packageName + " has no applicationInfo.");
return false;
}
- outInfo.uid = applicationInfo.uid;
+ if (outInfo != null) {
+ outInfo.uid = applicationInfo.uid;
+ }
// Delete package data from internal structures and also remove data if flag is set
removePackageDataLI(p, outInfo, flags);
@@ -5460,7 +5485,7 @@
String resourcePathString;
private long timeStamp;
private String timeStampString = "0";
- final int versionCode;
+ int versionCode;
PackageSignatures signatures = new PackageSignatures();
@@ -5698,10 +5723,6 @@
final String name = pkg.packageName;
PackageSetting p = getPackageLP(name, sharedUser, codePath,
resourcePath, pkg.mVersionCode, pkgFlags, create, add);
-
- if (p != null) {
- p.pkg = pkg;
- }
return p;
}
@@ -5849,22 +5870,18 @@
if (p != null) {
if (!p.codePath.equals(codePath)) {
// Check to see if its a disabled system app
- PackageSetting ps = mDisabledSysPackages.get(name);
- if((ps != null) && ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
+ if((p != null) && ((p.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
// This is an updated system app with versions in both system
// and data partition. Just let the most recent version
// take precedence.
- return p;
+ Log.w(TAG, "Trying to update system app code path from " +
+ p.codePathString + " to " + codePath.toString());
} else {
// 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);
- p.codePath = codePath;
- p.resourcePath = resourcePath;
- p.codePathString = codePath.toString();
- p.resourcePathString = resourcePath.toString();
}
} else if (p.sharedUser != sharedUser) {
reportSettingsProblem(Log.WARN,
@@ -5888,8 +5905,29 @@
if (sharedUser != null) {
p.userId = sharedUser.userId;
} else if (MULTIPLE_APPLICATION_UIDS) {
- // Assign new user id
- p.userId = newUserIdLP(p);
+ // Clone the setting here for disabled system packages
+ PackageSetting dis = mDisabledSysPackages.get(name);
+ if (dis != null) {
+ // For disabled packages a new setting is created
+ // from the existing user id. This still has to be
+ // added to list of user id's
+ // Copy signatures from previous setting
+ if (dis.signatures.mSignatures != null) {
+ p.signatures.mSignatures = dis.signatures.mSignatures.clone();
+ }
+ p.userId = dis.userId;
+ // Clone permissions
+ p.grantedPermissions = new HashSet<String>(dis.grantedPermissions);
+ p.loadedPermissions = new HashSet<String>(dis.loadedPermissions);
+ // Clone component info
+ p.disabledComponents = new HashSet<String>(dis.disabledComponents);
+ p.enabledComponents = new HashSet<String>(dis.enabledComponents);
+ // Add new setting to list of user ids
+ addUserIdLP(p.userId, p, name);
+ } else {
+ // Assign new user id
+ p.userId = newUserIdLP(p);
+ }
} else {
p.userId = FIRST_APPLICATION_UID;
}
@@ -5901,15 +5939,39 @@
if (add) {
// Finish adding new package by adding it and updating shared
// user preferences
- insertPackageSettingLP(p, name, sharedUser);
+ addPackageSettingLP(p, name, sharedUser);
}
}
return p;
}
-
+
+ private void insertPackageSettingLP(PackageSetting p, PackageParser.Package pkg,
+ File codePath, File resourcePath) {
+ p.pkg = pkg;
+ // 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);
+ 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);
+ p.resourcePath = resourcePath;
+ p.resourcePathString = resourcePath.toString();
+ }
+ // Update version code if needed
+ if (pkg.mVersionCode != p.versionCode) {
+ p.versionCode = pkg.mVersionCode;
+ }
+ addPackageSettingLP(p, pkg.packageName, p.sharedUser);
+ }
+
// Utility method that adds a PackageSetting to mPackages and
// completes updating the shared user attributes
- private void insertPackageSettingLP(PackageSetting p, String name,
+ private void addPackageSettingLP(PackageSetting p, String name,
SharedUserSetting sharedUser) {
mPackages.put(name, p);
if (sharedUser != null) {
@@ -6002,7 +6064,7 @@
}
if (mUserIds.get(index) != null) {
reportSettingsProblem(Log.ERROR,
- "Adding duplicate shared id: " + uid
+ "Adding duplicate user id: " + uid
+ " name=" + name);
return false;
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 4998945..5a02c4d 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -8179,7 +8179,9 @@
// This has changed the visibility of windows, so perform
// a new layout to get them all up-to-date.
mLayoutNeeded = true;
- moveInputMethodWindowsIfNeededLocked(true);
+ if (!moveInputMethodWindowsIfNeededLocked(true)) {
+ assignLayersLocked();
+ }
performLayoutLockedInner();
updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 81a715d..5ea59ca 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4736,7 +4736,30 @@
Binder.restoreCallingIdentity(callingId);
}
}
-
+
+ /*
+ * The pkg name and uid have to be specified.
+ * @see android.app.IActivityManager#killApplicationWithUid(java.lang.String, int)
+ */
+ public void killApplicationWithUid(String pkg, int uid) {
+ if (pkg == null) {
+ return;
+ }
+ // Make sure the uid is valid.
+ if (uid < 0) {
+ Log.w(TAG, "Invalid uid specified for pkg : " + pkg);
+ return;
+ }
+ int callerUid = Binder.getCallingUid();
+ // Only the system server can kill an application
+ if (callerUid == Process.SYSTEM_UID) {
+ uninstallPackageLocked(pkg, uid, false);
+ } else {
+ throw new SecurityException(callerUid + " cannot kill pkg: " +
+ pkg);
+ }
+ }
+
private void restartPackageLocked(final String packageName, int uid) {
uninstallPackageLocked(packageName, uid, false);
Intent intent = new Intent(Intent.ACTION_PACKAGE_RESTARTED,
diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java
index 775b034..fc491d7 100644
--- a/telephony/java/android/telephony/SmsMessage.java
+++ b/telephony/java/android/telephony/SmsMessage.java
@@ -278,8 +278,8 @@
public static int[] calculateLength(CharSequence msgBody, boolean use7bitOnly) {
int activePhone = TelephonyManager.getDefault().getPhoneType();
TextEncodingDetails ted = (PHONE_TYPE_CDMA == activePhone) ?
- com.android.internal.telephony.gsm.SmsMessage.calculateLength(msgBody, use7bitOnly) :
- com.android.internal.telephony.cdma.SmsMessage.calculateLength(msgBody, use7bitOnly);
+ com.android.internal.telephony.cdma.SmsMessage.calculateLength(msgBody, use7bitOnly) :
+ com.android.internal.telephony.gsm.SmsMessage.calculateLength(msgBody, use7bitOnly);
int ret[] = new int[4];
ret[0] = ted.msgCount;
ret[1] = ted.codeUnitCount;
@@ -299,8 +299,8 @@
public static ArrayList<String> fragmentText(String text) {
int activePhone = TelephonyManager.getDefault().getPhoneType();
TextEncodingDetails ted = (PHONE_TYPE_CDMA == activePhone) ?
- com.android.internal.telephony.gsm.SmsMessage.calculateLength(text, false) :
- com.android.internal.telephony.cdma.SmsMessage.calculateLength(text, false);
+ com.android.internal.telephony.cdma.SmsMessage.calculateLength(text, false) :
+ com.android.internal.telephony.gsm.SmsMessage.calculateLength(text, false);
// TODO(cleanup): The code here could be rolled into the logic
// below cleanly if these MAX_* constants were defined more
@@ -321,11 +321,8 @@
while (pos < textLen) {
int nextPos = 0; // Counts code units.
if (ted.codeUnitSize == ENCODING_7BIT) {
- if (PHONE_TYPE_CDMA == activePhone) {
- nextPos = pos + Math.min(limit, textLen - pos);
- } else {
- nextPos = GsmAlphabet.findGsmSeptetLimitIndex(text, pos, limit);
- }
+ // For multi-segment messages, CDMA 7bit equals GSM 7bit encoding (EMS mode).
+ nextPos = GsmAlphabet.findGsmSeptetLimitIndex(text, pos, limit);
} else { // Assume unicode.
nextPos = pos + Math.min(limit / 2, textLen - pos);
}