Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c6cbf41 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Better compat mode part one: start scaling windows." into honeycomb-mr2

parents 27944242 e2515eeb
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
@@ -106,6 +106,8 @@ public class Am {
            runDumpHeap();
            runDumpHeap();
        } else if (op.equals("monitor")) {
        } else if (op.equals("monitor")) {
            runMonitor();
            runMonitor();
        } else if (op.equals("screen-compat")) {
            runScreenCompat();
        } else {
        } else {
            throw new IllegalArgumentException("Unknown command: " + op);
            throw new IllegalArgumentException("Unknown command: " + op);
        }
        }
@@ -776,6 +778,29 @@ public class Am {
        controller.run();
        controller.run();
    }
    }


    private void runScreenCompat() throws Exception {
        String mode = nextArgRequired();
        boolean enabled;
        if ("on".equals(mode)) {
            enabled = true;
        } else if ("off".equals(mode)) {
            enabled = false;
        } else {
            System.err.println("Error: enabled mode must be 'on' or 'off' at " + mode);
            showUsage();
            return;
        }

        String packageName = nextArgRequired();
        do {
            try {
                mAm.setPackageScreenCompatMode(packageName, enabled);
            } catch (RemoteException e) {
            }
            packageName = nextArg();
        } while (packageName != null);
    }

    private class IntentReceiver extends IIntentReceiver.Stub {
    private class IntentReceiver extends IIntentReceiver.Stub {
        private boolean mFinished = false;
        private boolean mFinished = false;


@@ -956,6 +981,8 @@ public class Am {
                "    start monitoring: am monitor [--gdb <port>]\n" +
                "    start monitoring: am monitor [--gdb <port>]\n" +
                "        --gdb: start gdbserv on the given port at crash/ANR\n" +
                "        --gdb: start gdbserv on the given port at crash/ANR\n" +
                "\n" +
                "\n" +
                "    control screen compatibility: am screen-compat [on|off] [package]\n" +
                "\n" +
                "    <INTENT> specifications include these flags:\n" +
                "    <INTENT> specifications include these flags:\n" +
                "        [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" +
                "        [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" +
                "        [-c <CATEGORY> [-c <CATEGORY>] ...]\n" +
                "        [-c <CATEGORY> [-c <CATEGORY>] ...]\n" +
+23 −0
Original line number Original line Diff line number Diff line
@@ -1398,6 +1398,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
            return true;
        }
        }


        case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
        {
            data.enforceInterface(IActivityManager.descriptor);
            String pkg = data.readString();
            boolean enabled = data.readInt() != 0;
            setPackageScreenCompatMode(pkg, enabled);
            reply.writeNoException();
            return true;
        }

        }
        }


        return super.onTransact(code, data, reply, flags);
        return super.onTransact(code, data, reply, flags);
@@ -3142,5 +3152,18 @@ class ActivityManagerProxy implements IActivityManager
        return result;
        return result;
    }
    }


    public void setPackageScreenCompatMode(String packageName, boolean compatEnabled)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeString(packageName);
        data.writeInt(compatEnabled ? 1 : 0);
        mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
        reply.readException();
        reply.recycle();
        data.recycle();
    }

    private IBinder mRemote;
    private IBinder mRemote;
}
}
+118 −49

File changed.

Preview size limit exceeded, changes collapsed.

+49 −16

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Original line Diff line number Diff line
@@ -1372,7 +1372,7 @@ class ContextImpl extends Context {
        }
        }


        LoadedApk pi =
        LoadedApk pi =
            mMainThread.getPackageInfo(packageName, flags);
            mMainThread.getPackageInfo(packageName, mResources.getCompatibilityInfo(), flags);
        if (pi != null) {
        if (pi != null) {
            ContextImpl c = new ContextImpl();
            ContextImpl c = new ContextImpl();
            c.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED;
            c.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED;
@@ -1454,7 +1454,7 @@ class ContextImpl extends Context {
                        " compatiblity info:" + container.getDisplayMetrics());
                        " compatiblity info:" + container.getDisplayMetrics());
            }
            }
            mResources = mainThread.getTopLevelResources(
            mResources = mainThread.getTopLevelResources(
                    mPackageInfo.getResDir(), container.getCompatibilityInfo().copy());
                    mPackageInfo.getResDir(), container.getCompatibilityInfo());
        }
        }
        mMainThread = mainThread;
        mMainThread = mainThread;
        mContentResolver = new ApplicationContentResolver(this, mainThread);
        mContentResolver = new ApplicationContentResolver(this, mainThread);
Loading