* Reverted the change in PackageParser that I checked by accident

* More surface view fix.
  - correct event translation on surface view.
  - use compatible window
* removed FLAG_NO_COMPATIBILITY_SCALE. It was my misunderstanding of how SurfaceView works, and this was not necessary.
* Added compatibility related info to package dumpsys
This commit is contained in:
Mitsuru Oshima
2009-07-17 17:23:31 -07:00
parent 5c536e9162
commit 841f13c8e9
5 changed files with 25 additions and 14 deletions

View File

@@ -979,12 +979,12 @@ public class PackageParser {
/** /**
* TODO: enable this before code freeze. b/1967935 * TODO: enable this before code freeze. b/1967935
* * * *
*/
if ((densities == null || densities.length == 0) if ((densities == null || densities.length == 0)
&& (pkg.applicationInfo.targetSdkVersion && (pkg.applicationInfo.targetSdkVersion
>= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) { >= android.os.Build.VERSION_CODES.CUR_DEVELOPMENT)) {
pkg.supportsDensities = ApplicationInfo.ANY_DENSITIES_ARRAY; pkg.supportsDensities = ApplicationInfo.ANY_DENSITIES_ARRAY;
} }
*/
return pkg; return pkg;
} }

View File

@@ -224,8 +224,7 @@ public class CompatibilityInfo {
if (DBG) Log.d(TAG, "no translation required"); if (DBG) Log.d(TAG, "no translation required");
return null; return null;
} }
if (!isScalingRequired() || if (!isScalingRequired()) {
(params.flags & WindowManager.LayoutParams.FLAG_NO_COMPATIBILITY_SCALING) != 0) {
return null; return null;
} }
return new Translator(); return new Translator();

View File

@@ -257,7 +257,7 @@ public class SurfaceView extends View {
// scales the event back to the pre-scaled coordinates for such surface. // scales the event back to the pre-scaled coordinates for such surface.
if (mScaled) { if (mScaled) {
MotionEvent scaledBack = MotionEvent.obtain(event); MotionEvent scaledBack = MotionEvent.obtain(event);
scaledBack.scale(mTranslator.applicationScale); mTranslator.translateEventInScreenToAppWindow(event);
try { try {
return super.dispatchTouchEvent(scaledBack); return super.dispatchTouchEvent(scaledBack);
} finally { } finally {
@@ -296,7 +296,8 @@ public class SurfaceView extends View {
if (!mHaveFrame) { if (!mHaveFrame) {
return; return;
} }
mTranslator = ((ViewRoot)getRootView().getParent()).mTranslator; ViewRoot viewRoot = (ViewRoot) getRootView().getParent();
mTranslator = viewRoot.mTranslator;
float appScale = mTranslator == null ? 1.0f : mTranslator.applicationScale; float appScale = mTranslator == null ? 1.0f : mTranslator.applicationScale;
@@ -356,8 +357,10 @@ public class SurfaceView extends View {
| WindowManager.LayoutParams.FLAG_SCALED | WindowManager.LayoutParams.FLAG_SCALED
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_NO_COMPATIBILITY_SCALING
; ;
if (!getContext().getResources().getCompatibilityInfo().supportsScreen()) {
mLayout.flags |= WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
}
mLayout.memoryType = mRequestedType; mLayout.memoryType = mRequestedType;

View File

@@ -483,19 +483,12 @@ public interface WindowManager extends ViewManager {
* {@hide} */ * {@hide} */
public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
/** Window flag: special flag to let a window ignore the compatibility scaling.
* This is used by SurfaceView to pass this info into ViewRoot, and not used
* by WindowManager.
*
* {@hide} */
public static final int FLAG_NO_COMPATIBILITY_SCALING = 0x00100000;
/** Window flag: special flag to limit the size of the window to be /** Window flag: special flag to limit the size of the window to be
* original size ([320x480] x density). Used to create window for applications * original size ([320x480] x density). Used to create window for applications
* running under compatibility mode. * running under compatibility mode.
* *
* {@hide} */ * {@hide} */
public static final int FLAG_COMPATIBLE_WINDOW = 0x00200000; public static final int FLAG_COMPATIBLE_WINDOW = 0x00100000;
/** Window flag: a special option intended for system dialogs. When /** Window flag: a special option intended for system dialogs. When
* this flag is set, the window will demand focus unconditionally when * this flag is set, the window will demand focus unconditionally when

View File

@@ -4905,6 +4905,22 @@ class PackageManagerService extends IPackageManager.Stub {
pw.print(" resourcePath="); pw.println(ps.resourcePathString); pw.print(" resourcePath="); pw.println(ps.resourcePathString);
if (ps.pkg != null) { if (ps.pkg != null) {
pw.print(" dataDir="); pw.println(ps.pkg.applicationInfo.dataDir); pw.print(" dataDir="); pw.println(ps.pkg.applicationInfo.dataDir);
pw.print(" targetSdk="); pw.println(ps.pkg.applicationInfo.targetSdkVersion);
pw.print(" densities="); pw.println(ps.pkg.supportsDensityList);
ArrayList<String> screens = new ArrayList<String>();
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS) != 0) {
screens.add("medium");
}
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
screens.add("large");
}
if ((ps.pkg.applicationInfo.flags &
ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS) != 0) {
screens.add("small,");
}
pw.print(" supportsScreens="); pw.println(screens);
} }
pw.print(" timeStamp="); pw.println(ps.getTimeStampStr()); pw.print(" timeStamp="); pw.println(ps.getTimeStampStr());
pw.print(" signatures="); pw.println(ps.signatures); pw.print(" signatures="); pw.println(ps.signatures);