Loading core/java/android/app/ActivityManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,25 @@ public class ActivityManager { } } /** @hide */ public boolean getPackageAskScreenCompat(String packageName) { try { return ActivityManagerNative.getDefault().getPackageAskScreenCompat(packageName); } catch (RemoteException e) { // System dead, we will be dead too soon! return false; } } /** @hide */ public void setPackageAskScreenCompat(String packageName, boolean ask) { try { ActivityManagerNative.getDefault().setPackageAskScreenCompat(packageName, ask); } catch (RemoteException e) { // System dead, we will be dead too soon! } } /** * Return the approximate per-application memory class of the current * device. This gives you an idea of how hard a memory limit you should Loading core/java/android/app/ActivityManagerNative.java +48 −1 Original line number Diff line number Diff line Loading @@ -1437,6 +1437,26 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); boolean ask = getPackageAskScreenCompat(pkg); reply.writeNoException(); reply.writeInt(ask ? 1 : 0); return true; } case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); boolean ask = data.readInt() != 0; setPackageAskScreenCompat(pkg, ask); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); Loading Loading @@ -3208,7 +3228,8 @@ class ActivityManagerProxy implements IActivityManager Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); data.writeString(packageName); mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); reply.readException(); int mode = reply.readInt(); reply.recycle(); Loading @@ -3229,5 +3250,31 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); } public boolean getPackageAskScreenCompat(String packageName) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); reply.readException(); boolean ask = reply.readInt() != 0; reply.recycle(); data.recycle(); return ask; } public void setPackageAskScreenCompat(String packageName, boolean ask) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); data.writeInt(ask ? 1 : 0); mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); reply.readException(); reply.recycle(); data.recycle(); } private IBinder mRemote; } core/java/android/app/IActivityManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -347,6 +347,9 @@ public interface IActivityManager extends IInterface { public int getPackageScreenCompatMode(String packageName) throws RemoteException; public void setPackageScreenCompatMode(String packageName, int mode) throws RemoteException; public boolean getPackageAskScreenCompat(String packageName) throws RemoteException; public void setPackageAskScreenCompat(String packageName, boolean ask) throws RemoteException; /* * Private non-Binder interfaces Loading Loading @@ -567,4 +570,6 @@ public interface IActivityManager extends IInterface { int SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+124; int GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+125; int SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+126; int GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+127; int SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+128; } core/java/android/content/res/CompatibilityInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,13 @@ public class CompatibilityInfo implements Parcelable { public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, boolean forceCompat) { int compatFlags = 0; // We can't rely on the application always setting // FLAG_RESIZEABLE_FOR_SCREENS so will compute it based on various input. boolean anyResizeable = false; if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) { compatFlags |= LARGE_SCREENS; anyResizeable = true; if (!forceCompat) { // If we aren't forcing the app into compatibility mode, then // assume if it supports large screens that we should allow it Loading @@ -123,9 +128,13 @@ public class CompatibilityInfo implements Parcelable { } } if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) { anyResizeable = true; if (!forceCompat) { compatFlags |= XLARGE_SCREENS | EXPANDABLE; } } if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { anyResizeable = true; compatFlags |= EXPANDABLE; } Loading Loading @@ -160,7 +169,7 @@ public class CompatibilityInfo implements Parcelable { if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) { if ((compatFlags&EXPANDABLE) != 0) { supportsScreen = true; } else if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { } else if (!anyResizeable) { compatFlags |= ALWAYS_COMPAT; } } Loading core/res/res/layout/am_compat_mode_dialog.xml 0 → 100644 +60 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (C) 2010 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_marginTop="15dp" android:layout_marginBottom="15dp" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" android:baselineAligned="true"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:textColor="?android:attr/textColorPrimary" android:textSize="18sp" android:text="@string/screen_compat_mode_scale" /> <Switch android:id="@+id/compat_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="10dp" /> </LinearLayout> <View android:layout_width="wrap_content" android:layout_height="1dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:background="@android:drawable/divider_horizontal_dark" /> <CheckBox android:id="@+id/ask_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/screen_compat_mode_show" /> <TextView android:id="@+id/reask_hint" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:gravity="center" android:visibility="invisible" android:text="@string/screen_compat_mode_hint" /> </LinearLayout> Loading
core/java/android/app/ActivityManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,25 @@ public class ActivityManager { } } /** @hide */ public boolean getPackageAskScreenCompat(String packageName) { try { return ActivityManagerNative.getDefault().getPackageAskScreenCompat(packageName); } catch (RemoteException e) { // System dead, we will be dead too soon! return false; } } /** @hide */ public void setPackageAskScreenCompat(String packageName, boolean ask) { try { ActivityManagerNative.getDefault().setPackageAskScreenCompat(packageName, ask); } catch (RemoteException e) { // System dead, we will be dead too soon! } } /** * Return the approximate per-application memory class of the current * device. This gives you an idea of how hard a memory limit you should Loading
core/java/android/app/ActivityManagerNative.java +48 −1 Original line number Diff line number Diff line Loading @@ -1437,6 +1437,26 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); boolean ask = getPackageAskScreenCompat(pkg); reply.writeNoException(); reply.writeInt(ask ? 1 : 0); return true; } case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); boolean ask = data.readInt() != 0; setPackageAskScreenCompat(pkg, ask); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); Loading Loading @@ -3208,7 +3228,8 @@ class ActivityManagerProxy implements IActivityManager Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); data.writeString(packageName); mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); reply.readException(); int mode = reply.readInt(); reply.recycle(); Loading @@ -3229,5 +3250,31 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); } public boolean getPackageAskScreenCompat(String packageName) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); reply.readException(); boolean ask = reply.readInt() != 0; reply.recycle(); data.recycle(); return ask; } public void setPackageAskScreenCompat(String packageName, boolean ask) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeString(packageName); data.writeInt(ask ? 1 : 0); mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); reply.readException(); reply.recycle(); data.recycle(); } private IBinder mRemote; }
core/java/android/app/IActivityManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -347,6 +347,9 @@ public interface IActivityManager extends IInterface { public int getPackageScreenCompatMode(String packageName) throws RemoteException; public void setPackageScreenCompatMode(String packageName, int mode) throws RemoteException; public boolean getPackageAskScreenCompat(String packageName) throws RemoteException; public void setPackageAskScreenCompat(String packageName, boolean ask) throws RemoteException; /* * Private non-Binder interfaces Loading Loading @@ -567,4 +570,6 @@ public interface IActivityManager extends IInterface { int SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+124; int GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+125; int SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+126; int GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+127; int SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+128; }
core/java/android/content/res/CompatibilityInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,13 @@ public class CompatibilityInfo implements Parcelable { public CompatibilityInfo(ApplicationInfo appInfo, int screenLayout, boolean forceCompat) { int compatFlags = 0; // We can't rely on the application always setting // FLAG_RESIZEABLE_FOR_SCREENS so will compute it based on various input. boolean anyResizeable = false; if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) { compatFlags |= LARGE_SCREENS; anyResizeable = true; if (!forceCompat) { // If we aren't forcing the app into compatibility mode, then // assume if it supports large screens that we should allow it Loading @@ -123,9 +128,13 @@ public class CompatibilityInfo implements Parcelable { } } if ((appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_XLARGE_SCREENS) != 0) { anyResizeable = true; if (!forceCompat) { compatFlags |= XLARGE_SCREENS | EXPANDABLE; } } if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) { anyResizeable = true; compatFlags |= EXPANDABLE; } Loading Loading @@ -160,7 +169,7 @@ public class CompatibilityInfo implements Parcelable { if ((screenLayout&Configuration.SCREENLAYOUT_COMPAT_NEEDED) != 0) { if ((compatFlags&EXPANDABLE) != 0) { supportsScreen = true; } else if ((appInfo.flags & ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) == 0) { } else if (!anyResizeable) { compatFlags |= ALWAYS_COMPAT; } } Loading
core/res/res/layout/am_compat_mode_dialog.xml 0 → 100644 +60 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (C) 2010 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_marginTop="15dp" android:layout_marginBottom="15dp" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" android:baselineAligned="true"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:textColor="?android:attr/textColorPrimary" android:textSize="18sp" android:text="@string/screen_compat_mode_scale" /> <Switch android:id="@+id/compat_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="10dp" /> </LinearLayout> <View android:layout_width="wrap_content" android:layout_height="1dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:background="@android:drawable/divider_horizontal_dark" /> <CheckBox android:id="@+id/ask_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/screen_compat_mode_show" /> <TextView android:id="@+id/reask_hint" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:gravity="center" android:visibility="invisible" android:text="@string/screen_compat_mode_hint" /> </LinearLayout>