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

Commit 30d71890 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #3274841: Orientation change problem with a paused activity

Plus a bunch of debug output improvements.

And some new Intent helpers for dealing with restarting an app.

Change-Id: I50ec56bca6a86c562156b13fe8a6fdf68038a12e
parent 5bd7d934
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -22167,6 +22167,8 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="prefix" type="java.lang.String">
</parameter>
<parameter name="fd" type="java.io.FileDescriptor">
</parameter>
<parameter name="writer" type="java.io.PrintWriter">
@@ -32145,6 +32147,25 @@
 visibility="public"
>
</constructor>
<method name="dump"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="prefix" type="java.lang.String">
</parameter>
<parameter name="fd" type="java.io.FileDescriptor">
</parameter>
<parameter name="writer" type="java.io.PrintWriter">
</parameter>
<parameter name="args" type="java.lang.String[]">
</parameter>
</method>
<method name="getLoader"
 return="android.content.Loader&lt;D&gt;"
 abstract="true"
@@ -50670,6 +50691,32 @@
 visibility="public"
>
</method>
<method name="makeMainActivity"
 return="android.content.Intent"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="mainActivity" type="android.content.ComponentName">
</parameter>
</method>
<method name="makeRestartActivityTask"
 return="android.content.Intent"
 abstract="false"
 native="false"
 synchronized="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="mainActivity" type="android.content.ComponentName">
</parameter>
</method>
<method name="parseIntent"
 return="android.content.Intent"
 abstract="false"
+24 −3
Original line number Diff line number Diff line
@@ -4095,15 +4095,36 @@ public class Activity extends ContextThemeWrapper

    /**
     * Print the Activity's state into the given stream.  This gets invoked if
     * you run "adb shell dumpsys activity <youractivityname>".
     * you run "adb shell dumpsys activity <activity_component_name>".
     *
     * @param prefix Desired prefix to prepend at each line of output.
     * @param fd The raw file descriptor that the dump is being sent to.
     * @param writer The PrintWriter to which you should dump your state.  This will be
     * closed for you after you return.
     * @param args additional arguments to the dump request.
     */
    public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
        mFragments.dump("", fd, writer, args);
    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
        writer.print(prefix); writer.print("Local Activity ");
                writer.print(Integer.toHexString(System.identityHashCode(this)));
                writer.println(" State:");
        String innerPrefix = prefix + "  ";
        writer.print(innerPrefix); writer.print("mResumed=");
                writer.print(mResumed); writer.print(" mStopped=");
                writer.print(mStopped); writer.print(" mFinished=");
                writer.println(mFinished);
        writer.print(innerPrefix); writer.print("mLoadersStarted=");
                writer.println(mLoadersStarted);
        writer.print(innerPrefix); writer.print("mChangingConfigurations=");
                writer.println(mChangingConfigurations);
        writer.print(innerPrefix); writer.print("mCurrentConfig=");
                writer.println(mCurrentConfig);
        if (mLoaderManager != null) {
            writer.print(prefix); writer.print("Loader Manager ");
                    writer.print(Integer.toHexString(System.identityHashCode(mLoaderManager)));
                    writer.println(":");
            mLoaderManager.dump(prefix + "  ", fd, writer, args);
        }
        mFragments.dump(prefix, fd, writer, args);
    }

    /**
+5 −2
Original line number Diff line number Diff line
@@ -361,6 +361,7 @@ public final class ActivityThread {
    private static final class DumpComponentInfo {
        FileDescriptor fd;
        IBinder token;
        String prefix;
        String[] args;
        boolean dumped;
    }
@@ -680,10 +681,12 @@ public final class ActivityThread {
            queueOrSendMessage(H.SCHEDULE_CRASH, msg);
        }

        public void dumpActivity(FileDescriptor fd, IBinder activitytoken, String[] args) {
        public void dumpActivity(FileDescriptor fd, IBinder activitytoken,
                String prefix, String[] args) {
            DumpComponentInfo data = new DumpComponentInfo();
            data.fd = fd;
            data.token = activitytoken;
            data.prefix = prefix;
            data.args = args;
            data.dumped = false;
            queueOrSendMessage(H.DUMP_ACTIVITY, data);
@@ -2076,7 +2079,7 @@ public final class ActivityThread {
            ActivityClientRecord r = mActivities.get(info.token);
            if (r != null && r.activity != null) {
                PrintWriter pw = new PrintWriter(new FileOutputStream(info.fd));
                r.activity.dump(info.fd, pw, info.args);
                r.activity.dump(info.prefix, info.fd, pw, info.args);
                pw.close();
            }
        } finally {
+3 −2
Original line number Diff line number Diff line
@@ -115,8 +115,9 @@ final class ApplicationPackageManager extends PackageManager {
            return null;
        }
        Intent intent = new Intent(intentToResolve);
        intent.setClassName(resolveInfo.activityInfo.applicationInfo.packageName,
                            resolveInfo.activityInfo.name);
        // Note: we do NOT fill in the component name; we'll leave the
        // Intent unspecified, so if there are multiple matches within the
        // package something reasonable will happen.
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        return intent;
    }
+4 −2
Original line number Diff line number Diff line
@@ -434,9 +434,10 @@ public abstract class ApplicationThreadNative extends Binder
            data.enforceInterface(IApplicationThread.descriptor);
            ParcelFileDescriptor fd = data.readFileDescriptor();
            final IBinder activity = data.readStrongBinder();
            final String prefix = data.readString();
            final String[] args = data.readStringArray();
            if (fd != null) {
                dumpActivity(fd.getFileDescriptor(), activity, args);
                dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
                try {
                    fd.close();
                } catch (IOException e) {
@@ -906,12 +907,13 @@ class ApplicationThreadProxy implements IApplicationThread {
        data.recycle();
    }

    public void dumpActivity(FileDescriptor fd, IBinder token, String[] args)
    public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
            throws RemoteException {
        Parcel data = Parcel.obtain();
        data.writeInterfaceToken(IApplicationThread.descriptor);
        data.writeFileDescriptor(fd);
        data.writeStrongBinder(token);
        data.writeString(prefix);
        data.writeStringArray(args);
        mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, 0);
        data.recycle();
Loading