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

Commit 1704e3cf authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

The pm command is no more.

It is now just a shell of itself. :)

Also brings in a few fixes to never try to open files from the system
process.

Test: manual
Change-Id: Ia8187196af597046fd2e7092dbf19ce1dc1ea457
parent 9352e47d
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -2,15 +2,9 @@
#
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_MODULE := pmlib
LOCAL_MODULE_STEM := pm
include $(BUILD_JAVA_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := pm
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := pm
LOCAL_REQUIRED_MODULES := pmlib
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_TAGS := optional
include $(BUILD_PREBUILT)
+1 −7
Original line number Diff line number Diff line
#!/system/bin/sh
# Script to start "pm" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/pm.jar
exec app_process $base/bin com.android.commands.pm.Pm "$@"
cmd package "$@"
+0 −822

File deleted.

Preview size limit exceeded, changes collapsed.

+3 −0
Original line number Diff line number Diff line
@@ -105,6 +105,9 @@ public class ShellCallback implements Parcelable {
    ShellCallback(Parcel in) {
        mLocal = false;
        mShellCallback = IShellCallback.Stub.asInterface(in.readStrongBinder());
        if (mShellCallback != null) {
            Binder.allowBlocking(mShellCallback.asBinder());
        }
    }

    public static final Parcelable.Creator<ShellCallback> CREATOR
+11 −1
Original line number Diff line number Diff line
@@ -91,7 +91,13 @@ public abstract class ShellCommand {
        mCmd = cmd;
        mResultReceiver = resultReceiver;

        if (DEBUG) Slog.d(TAG, "Starting command " + mCmd + " on " + mTarget);
        if (DEBUG) {
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Slog.d(TAG, "Starting command " + mCmd + " on " + mTarget, here);
            Slog.d(TAG, "Calling uid=" + Binder.getCallingUid()
                    + " pid=" + Binder.getCallingPid() + " ShellCallback=" + getShellCallback());
        }
        int res = -1;
        try {
            res = onCommand(mCmd);
@@ -227,15 +233,19 @@ public abstract class ShellCommand {
     * @hide
     */
    public ParcelFileDescriptor openFileForSystem(String path, String mode) {
        if (DEBUG) Slog.d(TAG, "openFileForSystem: " + path + " mode=" + mode);
        try {
            ParcelFileDescriptor pfd = getShellCallback().openFile(path,
                    "u:r:system_server:s0", mode);
            if (pfd != null) {
                if (DEBUG) Slog.d(TAG, "Got file: " + pfd);
                return pfd;
            }
        } catch (RuntimeException e) {
            if (DEBUG) Slog.d(TAG, "Failure opening file: " + e.getMessage());
            getErrPrintWriter().println("Failure opening file: " + e.getMessage());
        }
        if (DEBUG) Slog.d(TAG, "Error: Unable to open file: " + path);
        getErrPrintWriter().println("Error: Unable to open file: " + path);
        getErrPrintWriter().println("Consider using a file under /data/local/tmp/");
        return null;
Loading