Merge "Fix issue #4502672: Wrong xml resources used for homescreen widgets." into honeycomb-mr2
This commit is contained in:
committed by
Android (Google) Code Review
commit
75d6b3c2a2
@ -172,6 +172,11 @@ public final class ActivityThread {
|
|||||||
// These can be accessed by multiple threads; mPackages is the lock.
|
// These can be accessed by multiple threads; mPackages is the lock.
|
||||||
// XXX For now we keep around information about all packages we have
|
// XXX For now we keep around information about all packages we have
|
||||||
// seen, not removing entries from this map.
|
// seen, not removing entries from this map.
|
||||||
|
// NOTE: The activity manager in its process needs to call in to
|
||||||
|
// ActivityThread to do things like update resource configurations,
|
||||||
|
// which means this lock gets held while the activity manager holds its
|
||||||
|
// own lock. Thus you MUST NEVER call back into the activity manager
|
||||||
|
// or anything that depends on it while holding this lock.
|
||||||
final HashMap<String, WeakReference<LoadedApk>> mPackages
|
final HashMap<String, WeakReference<LoadedApk>> mPackages
|
||||||
= new HashMap<String, WeakReference<LoadedApk>>();
|
= new HashMap<String, WeakReference<LoadedApk>>();
|
||||||
final HashMap<String, WeakReference<LoadedApk>> mResourcePackages
|
final HashMap<String, WeakReference<LoadedApk>> mResourcePackages
|
||||||
@ -1480,7 +1485,7 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
return mConfiguration;
|
return mResConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProfiling() {
|
public boolean isProfiling() {
|
||||||
@ -1525,7 +1530,7 @@ public final class ActivityThread {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
ContextImpl context = getSystemContext();
|
ContextImpl context = getSystemContext();
|
||||||
context.init(new LoadedApk(this, "android", context, info,
|
context.init(new LoadedApk(this, "android", context, info,
|
||||||
new CompatibilityInfo(info, 0, 0, false)), null, this);
|
CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO), null, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3274,6 +3279,12 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void applyConfigurationToResources(Configuration config) {
|
||||||
|
synchronized (mPackages) {
|
||||||
|
applyConfigurationToResourcesLocked(config, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final boolean applyConfigurationToResourcesLocked(Configuration config,
|
final boolean applyConfigurationToResourcesLocked(Configuration config,
|
||||||
CompatibilityInfo compat) {
|
CompatibilityInfo compat) {
|
||||||
if (mResConfiguration == null) {
|
if (mResConfiguration == null) {
|
||||||
@ -3492,8 +3503,7 @@ public final class ActivityThread {
|
|||||||
* reflect configuration changes. The configuration object passed
|
* reflect configuration changes. The configuration object passed
|
||||||
* in AppBindData can be safely assumed to be up to date
|
* in AppBindData can be safely assumed to be up to date
|
||||||
*/
|
*/
|
||||||
Resources.getSystem().updateConfiguration(mConfiguration,
|
applyConfigurationToResourcesLocked(data.config, data.compatInfo);
|
||||||
Resources.getSystem().getDisplayMetrics(), data.compatInfo);
|
|
||||||
|
|
||||||
data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo);
|
data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo);
|
||||||
|
|
||||||
|
@ -98,6 +98,12 @@ final class LoadedApk {
|
|||||||
return mApplication;
|
return mApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create information about a new .apk
|
||||||
|
*
|
||||||
|
* NOTE: This constructor is called with ActivityThread's lock held,
|
||||||
|
* so MUST NOT call back out to the activity manager.
|
||||||
|
*/
|
||||||
public LoadedApk(ActivityThread activityThread, ApplicationInfo aInfo,
|
public LoadedApk(ActivityThread activityThread, ApplicationInfo aInfo,
|
||||||
CompatibilityInfo compatInfo,
|
CompatibilityInfo compatInfo,
|
||||||
ActivityThread mainThread, ClassLoader baseLoader,
|
ActivityThread mainThread, ClassLoader baseLoader,
|
||||||
|
@ -243,11 +243,11 @@ public class CompatibilityInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean neverSupportsScreen() {
|
public boolean neverSupportsScreen() {
|
||||||
return (mCompatibilityFlags&NEVER_NEEDS_COMPAT) != 0;
|
return (mCompatibilityFlags&ALWAYS_NEEDS_COMPAT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean alwaysSupportsScreen() {
|
public boolean alwaysSupportsScreen() {
|
||||||
return (mCompatibilityFlags&ALWAYS_NEEDS_COMPAT) != 0;
|
return (mCompatibilityFlags&NEVER_NEEDS_COMPAT) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,7 +406,7 @@ public class CompatibilityInfo implements Parcelable {
|
|||||||
if (!supportsScreen()) {
|
if (!supportsScreen()) {
|
||||||
// This is a larger screen device and the app is not
|
// This is a larger screen device and the app is not
|
||||||
// compatible with large screens, so diddle it.
|
// compatible with large screens, so diddle it.
|
||||||
CompatibilityInfo.updateCompatibleScreenFrame(inoutDm, null, inoutDm);
|
CompatibilityInfo.computeCompatibleScaling(inoutDm, inoutDm);
|
||||||
} else {
|
} else {
|
||||||
inoutDm.widthPixels = inoutDm.unscaledWidthPixels;
|
inoutDm.widthPixels = inoutDm.unscaledWidthPixels;
|
||||||
inoutDm.heightPixels = inoutDm.unscaledHeightPixels;
|
inoutDm.heightPixels = inoutDm.unscaledHeightPixels;
|
||||||
@ -443,8 +443,7 @@ public class CompatibilityInfo implements Parcelable {
|
|||||||
* @param outRect the output parameter which will contain the result.
|
* @param outRect the output parameter which will contain the result.
|
||||||
* @return Returns the scaling factor for the window.
|
* @return Returns the scaling factor for the window.
|
||||||
*/
|
*/
|
||||||
public static float updateCompatibleScreenFrame(DisplayMetrics dm,
|
public static float computeCompatibleScaling(DisplayMetrics dm, DisplayMetrics outDm) {
|
||||||
Rect outRect, DisplayMetrics outDm) {
|
|
||||||
final int width = dm.unscaledWidthPixels;
|
final int width = dm.unscaledWidthPixels;
|
||||||
final int height = dm.unscaledHeightPixels;
|
final int height = dm.unscaledHeightPixels;
|
||||||
int shortSize, longSize;
|
int shortSize, longSize;
|
||||||
@ -477,12 +476,6 @@ public class CompatibilityInfo implements Parcelable {
|
|||||||
scale = 1;
|
scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outRect != null) {
|
|
||||||
final int left = (int)((width-(newWidth*scale))/2);
|
|
||||||
final int top = (int)((height-(newHeight*scale))/2);
|
|
||||||
outRect.set(left, top, left+newWidth, top+newHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outDm != null) {
|
if (outDm != null) {
|
||||||
outDm.widthPixels = newWidth;
|
outDm.widthPixels = newWidth;
|
||||||
outDm.heightPixels = newHeight;
|
outDm.heightPixels = newHeight;
|
||||||
|
@ -330,17 +330,17 @@ public final class Configuration implements Parcelable, Comparable<Configuration
|
|||||||
if (smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
|
if (smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) {
|
||||||
sb.append(" sw"); sb.append(smallestScreenWidthDp); sb.append("dp");
|
sb.append(" sw"); sb.append(smallestScreenWidthDp); sb.append("dp");
|
||||||
} else {
|
} else {
|
||||||
sb.append("?swdp");
|
sb.append(" ?swdp");
|
||||||
}
|
}
|
||||||
if (screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
|
if (screenWidthDp != SCREEN_WIDTH_DP_UNDEFINED) {
|
||||||
sb.append(" w"); sb.append(screenWidthDp); sb.append("dp");
|
sb.append(" w"); sb.append(screenWidthDp); sb.append("dp");
|
||||||
} else {
|
} else {
|
||||||
sb.append("?wdp");
|
sb.append(" ?wdp");
|
||||||
}
|
}
|
||||||
if (screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
|
if (screenHeightDp != SCREEN_HEIGHT_DP_UNDEFINED) {
|
||||||
sb.append(" h"); sb.append(screenHeightDp); sb.append("dp");
|
sb.append(" h"); sb.append(screenHeightDp); sb.append("dp");
|
||||||
} else {
|
} else {
|
||||||
sb.append("?hdp");
|
sb.append(" ?hdp");
|
||||||
}
|
}
|
||||||
switch ((screenLayout&SCREENLAYOUT_SIZE_MASK)) {
|
switch ((screenLayout&SCREENLAYOUT_SIZE_MASK)) {
|
||||||
case SCREENLAYOUT_SIZE_UNDEFINED: sb.append(" ?lsize"); break;
|
case SCREENLAYOUT_SIZE_UNDEFINED: sb.append(" ?lsize"); break;
|
||||||
|
@ -28,14 +28,13 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.graphics.drawable.Drawable.ConstantState;
|
import android.graphics.drawable.Drawable.ConstantState;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.util.LongSparseArray;
|
import android.util.LongSparseArray;
|
||||||
import android.view.Display;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -1406,6 +1405,12 @@ public class Resources {
|
|||||||
public void updateConfiguration(Configuration config,
|
public void updateConfiguration(Configuration config,
|
||||||
DisplayMetrics metrics, CompatibilityInfo compat) {
|
DisplayMetrics metrics, CompatibilityInfo compat) {
|
||||||
synchronized (mTmpValue) {
|
synchronized (mTmpValue) {
|
||||||
|
if (false) {
|
||||||
|
Slog.i(TAG, "**** Updating config of " + this + ": old config is "
|
||||||
|
+ mConfiguration + " old compat is " + mCompatibilityInfo);
|
||||||
|
Slog.i(TAG, "**** Updating config of " + this + ": new config is "
|
||||||
|
+ config + " new compat is " + compat);
|
||||||
|
}
|
||||||
if (compat != null) {
|
if (compat != null) {
|
||||||
mCompatibilityInfo = compat;
|
mCompatibilityInfo = compat;
|
||||||
}
|
}
|
||||||
@ -1471,6 +1476,11 @@ public class Resources {
|
|||||||
mConfiguration.screenLayout, mConfiguration.uiMode,
|
mConfiguration.screenLayout, mConfiguration.uiMode,
|
||||||
Build.VERSION.RESOURCES_SDK_INT);
|
Build.VERSION.RESOURCES_SDK_INT);
|
||||||
|
|
||||||
|
if (false) {
|
||||||
|
Slog.i(TAG, "**** Updating config of " + this + ": final config is " + mConfiguration
|
||||||
|
+ " final compat is " + mCompatibilityInfo);
|
||||||
|
}
|
||||||
|
|
||||||
clearDrawableCache(mDrawableCache, configChanges);
|
clearDrawableCache(mDrawableCache, configChanges);
|
||||||
clearDrawableCache(mColorDrawableCache, configChanges);
|
clearDrawableCache(mColorDrawableCache, configChanges);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ package android.view;
|
|||||||
import com.android.internal.view.IInputContext;
|
import com.android.internal.view.IInputContext;
|
||||||
import com.android.internal.view.IInputMethodClient;
|
import com.android.internal.view.IInputMethodClient;
|
||||||
|
|
||||||
|
import android.content.res.CompatibilityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
@ -88,7 +89,7 @@ interface IWindowManager
|
|||||||
void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
|
void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
|
||||||
void executeAppTransition();
|
void executeAppTransition();
|
||||||
void setAppStartingWindow(IBinder token, String pkg, int theme,
|
void setAppStartingWindow(IBinder token, String pkg, int theme,
|
||||||
CharSequence nonLocalizedLabel, int labelRes,
|
in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
|
||||||
int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
|
int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
|
||||||
void setAppWillBeHidden(IBinder token);
|
void setAppWillBeHidden(IBinder token);
|
||||||
void setAppVisibility(IBinder token, boolean visible);
|
void setAppVisibility(IBinder token, boolean visible);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.CompatibilityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@ -537,7 +538,7 @@ public interface WindowManagerPolicy {
|
|||||||
* @see #removeStartingWindow
|
* @see #removeStartingWindow
|
||||||
*/
|
*/
|
||||||
public View addStartingWindow(IBinder appToken, String packageName,
|
public View addStartingWindow(IBinder appToken, String packageName,
|
||||||
int theme, CharSequence nonLocalizedLabel,
|
int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel,
|
||||||
int labelRes, int icon, int windowFlags);
|
int labelRes, int icon, int windowFlags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.CompatibilityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
@ -1110,9 +1111,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public View addStartingWindow(IBinder appToken, String packageName,
|
public View addStartingWindow(IBinder appToken, String packageName, int theme,
|
||||||
int theme, CharSequence nonLocalizedLabel,
|
CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
|
||||||
int labelRes, int icon, int windowFlags) {
|
int icon, int windowFlags) {
|
||||||
if (!SHOW_STARTING_ANIMATIONS) {
|
if (!SHOW_STARTING_ANIMATIONS) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1158,6 +1159,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
|
||||||
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||||
|
|
||||||
|
if (!compatInfo.supportsScreen()) {
|
||||||
|
win.addFlags(WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
win.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
|
win.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
|
||||||
WindowManager.LayoutParams.MATCH_PARENT);
|
WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.impl.SimpleLog;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
import org.xmlpull.v1.XmlSerializer;
|
import org.xmlpull.v1.XmlSerializer;
|
||||||
|
@ -12217,6 +12217,15 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
ac.updateConfiguration(mConfiguration);
|
ac.updateConfiguration(mConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure all resources in our process are updated
|
||||||
|
// right now, so that anyone who is going to retrieve
|
||||||
|
// resource values after we return will be sure to get
|
||||||
|
// the new ones. This is especially important during
|
||||||
|
// boot, where the first config change needs to guarantee
|
||||||
|
// all resources have that config before following boot
|
||||||
|
// code is executed.
|
||||||
|
mSystemThread.applyConfigurationToResources(newConfig);
|
||||||
|
|
||||||
if (Settings.System.hasInterestingConfigurationChanges(changes)) {
|
if (Settings.System.hasInterestingConfigurationChanges(changes)) {
|
||||||
Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG);
|
Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG);
|
||||||
msg.obj = new Configuration(mConfiguration);
|
msg.obj = new Configuration(mConfiguration);
|
||||||
|
@ -1455,6 +1455,8 @@ public class ActivityStack {
|
|||||||
if (SHOW_APP_STARTING_PREVIEW && mMainStack) {
|
if (SHOW_APP_STARTING_PREVIEW && mMainStack) {
|
||||||
mService.mWindowManager.setAppStartingWindow(
|
mService.mWindowManager.setAppStartingWindow(
|
||||||
next, next.packageName, next.theme,
|
next, next.packageName, next.theme,
|
||||||
|
mService.compatibilityInfoForPackageLocked(
|
||||||
|
next.info.applicationInfo),
|
||||||
next.nonLocalizedLabel,
|
next.nonLocalizedLabel,
|
||||||
next.labelRes, next.icon, next.windowFlags,
|
next.labelRes, next.icon, next.windowFlags,
|
||||||
null, true);
|
null, true);
|
||||||
@ -1491,6 +1493,8 @@ public class ActivityStack {
|
|||||||
if (SHOW_APP_STARTING_PREVIEW) {
|
if (SHOW_APP_STARTING_PREVIEW) {
|
||||||
mService.mWindowManager.setAppStartingWindow(
|
mService.mWindowManager.setAppStartingWindow(
|
||||||
next, next.packageName, next.theme,
|
next, next.packageName, next.theme,
|
||||||
|
mService.compatibilityInfoForPackageLocked(
|
||||||
|
next.info.applicationInfo),
|
||||||
next.nonLocalizedLabel,
|
next.nonLocalizedLabel,
|
||||||
next.labelRes, next.icon, next.windowFlags,
|
next.labelRes, next.icon, next.windowFlags,
|
||||||
null, true);
|
null, true);
|
||||||
@ -1617,7 +1621,9 @@ public class ActivityStack {
|
|||||||
else if (prev.nowVisible) prev = null;
|
else if (prev.nowVisible) prev = null;
|
||||||
}
|
}
|
||||||
mService.mWindowManager.setAppStartingWindow(
|
mService.mWindowManager.setAppStartingWindow(
|
||||||
r, r.packageName, r.theme, r.nonLocalizedLabel,
|
r, r.packageName, r.theme,
|
||||||
|
mService.compatibilityInfoForPackageLocked(
|
||||||
|
r.info.applicationInfo), r.nonLocalizedLabel,
|
||||||
r.labelRes, r.icon, r.windowFlags, prev, showStartingIcon);
|
r.labelRes, r.icon, r.windowFlags, prev, showStartingIcon);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,9 +150,11 @@ public class CompatModePackages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompatibilityInfo compatibilityInfoForPackageLocked(ApplicationInfo ai) {
|
public CompatibilityInfo compatibilityInfoForPackageLocked(ApplicationInfo ai) {
|
||||||
return new CompatibilityInfo(ai, mService.mConfiguration.screenLayout,
|
CompatibilityInfo ci = new CompatibilityInfo(ai, mService.mConfiguration.screenLayout,
|
||||||
mService.mConfiguration.smallestScreenWidthDp,
|
mService.mConfiguration.smallestScreenWidthDp,
|
||||||
(getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0);
|
(getPackageFlags(ai.packageName)&COMPAT_FLAG_ENABLED) != 0);
|
||||||
|
//Slog.i(TAG, "*********** COMPAT FOR PKG " + ai.packageName + ": " + ci);
|
||||||
|
return ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int computeCompatModeLocked(ApplicationInfo ai) {
|
public int computeCompatModeLocked(ApplicationInfo ai) {
|
||||||
|
@ -16,18 +16,23 @@
|
|||||||
|
|
||||||
package com.android.server.wm;
|
package com.android.server.wm;
|
||||||
|
|
||||||
|
import android.content.res.CompatibilityInfo;
|
||||||
|
|
||||||
final class StartingData {
|
final class StartingData {
|
||||||
final String pkg;
|
final String pkg;
|
||||||
final int theme;
|
final int theme;
|
||||||
|
final CompatibilityInfo compatInfo;
|
||||||
final CharSequence nonLocalizedLabel;
|
final CharSequence nonLocalizedLabel;
|
||||||
final int labelRes;
|
final int labelRes;
|
||||||
final int icon;
|
final int icon;
|
||||||
final int windowFlags;
|
final int windowFlags;
|
||||||
|
|
||||||
StartingData(String _pkg, int _theme, CharSequence _nonLocalizedLabel,
|
StartingData(String _pkg, int _theme, CompatibilityInfo _compatInfo,
|
||||||
|
CharSequence _nonLocalizedLabel,
|
||||||
int _labelRes, int _icon, int _windowFlags) {
|
int _labelRes, int _icon, int _windowFlags) {
|
||||||
pkg = _pkg;
|
pkg = _pkg;
|
||||||
theme = _theme;
|
theme = _theme;
|
||||||
|
compatInfo = _compatInfo;
|
||||||
nonLocalizedLabel = _nonLocalizedLabel;
|
nonLocalizedLabel = _nonLocalizedLabel;
|
||||||
labelRes = _labelRes;
|
labelRes = _labelRes;
|
||||||
icon = _icon;
|
icon = _icon;
|
||||||
|
@ -602,8 +602,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
|
|
||||||
final Configuration mTempConfiguration = new Configuration();
|
final Configuration mTempConfiguration = new Configuration();
|
||||||
|
|
||||||
// The frame use to limit the size of the app running in compatibility mode.
|
// The desired scaling factor for compatible apps.
|
||||||
Rect mCompatibleScreenFrame = new Rect();
|
|
||||||
float mCompatibleScreenScale;
|
float mCompatibleScreenScale;
|
||||||
|
|
||||||
public static WindowManagerService main(Context context,
|
public static WindowManagerService main(Context context,
|
||||||
@ -3526,7 +3525,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAppStartingWindow(IBinder token, String pkg,
|
public void setAppStartingWindow(IBinder token, String pkg,
|
||||||
int theme, CharSequence nonLocalizedLabel, int labelRes, int icon,
|
int theme, CompatibilityInfo compatInfo,
|
||||||
|
CharSequence nonLocalizedLabel, int labelRes, int icon,
|
||||||
int windowFlags, IBinder transferFrom, boolean createIfNeeded) {
|
int windowFlags, IBinder transferFrom, boolean createIfNeeded) {
|
||||||
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
|
||||||
"setAppStartingIcon()")) {
|
"setAppStartingIcon()")) {
|
||||||
@ -3676,8 +3676,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
mStartingIconInTransition = true;
|
mStartingIconInTransition = true;
|
||||||
wtoken.startingData = new StartingData(
|
wtoken.startingData = new StartingData(pkg, theme, compatInfo, nonLocalizedLabel,
|
||||||
pkg, theme, nonLocalizedLabel,
|
|
||||||
labelRes, icon, windowFlags);
|
labelRes, icon, windowFlags);
|
||||||
Message m = mH.obtainMessage(H.ADD_STARTING, wtoken);
|
Message m = mH.obtainMessage(H.ADD_STARTING, wtoken);
|
||||||
// Note: we really want to do sendMessageAtFrontOfQueue() because we
|
// Note: we really want to do sendMessageAtFrontOfQueue() because we
|
||||||
@ -5562,8 +5561,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
dm.heightPixels = dm.unscaledHeightPixels = mAppDisplayHeight
|
dm.heightPixels = dm.unscaledHeightPixels = mAppDisplayHeight
|
||||||
= mPolicy.getNonDecorDisplayHeight(mRotation, dh);
|
= mPolicy.getNonDecorDisplayHeight(mRotation, dh);
|
||||||
|
|
||||||
mCompatibleScreenScale = CompatibilityInfo.updateCompatibleScreenFrame(
|
mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm, null);
|
||||||
dm, mCompatibleScreenFrame, null);
|
|
||||||
|
|
||||||
config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(mRotation, dw) / dm.density);
|
config.screenWidthDp = (int)(mPolicy.getConfigDisplayWidth(mRotation, dw) / dm.density);
|
||||||
config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(mRotation, dh) / dm.density);
|
config.screenHeightDp = (int)(mPolicy.getConfigDisplayHeight(mRotation, dh) / dm.density);
|
||||||
@ -6138,9 +6136,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
View view = null;
|
View view = null;
|
||||||
try {
|
try {
|
||||||
view = mPolicy.addStartingWindow(
|
view = mPolicy.addStartingWindow(
|
||||||
wtoken.token, sd.pkg,
|
wtoken.token, sd.pkg, sd.theme, sd.compatInfo,
|
||||||
sd.theme, sd.nonLocalizedLabel, sd.labelRes,
|
sd.nonLocalizedLabel, sd.labelRes, sd.icon, sd.windowFlags);
|
||||||
sd.icon, sd.windowFlags);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.w(TAG, "Exception when adding starting window", e);
|
Slog.w(TAG, "Exception when adding starting window", e);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ public class WindowManagerPermissionTests extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mWm.setAppStartingWindow(null, "foo", 0, null, 0, 0, 0, null, false);
|
mWm.setAppStartingWindow(null, "foo", 0, null, null, 0, 0, 0, null, false);
|
||||||
fail("IWindowManager.setAppStartingWindow did not throw SecurityException as"
|
fail("IWindowManager.setAppStartingWindow did not throw SecurityException as"
|
||||||
+ " expected");
|
+ " expected");
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
|
Reference in New Issue
Block a user