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

Commit 7fa385ab authored by Selim Cinek's avatar Selim Cinek
Browse files

Launching notification settings correctly inline

Previously, the panel would still collapse when launching
the notification settings. We're now looking at the
newly returned result of the activity launch instead to
determine if we should collapse.

Bug: 69168591
Test: launch settings activity from notification guts, observe no collapsing
Change-Id: I414e7f4a9fd22d4f0b46437bfdb94e5c0f6cce58
parent 2627d72e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -913,14 +913,14 @@ class ContextImpl extends Context {

    /** @hide */
    @Override
    public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
        if ((intents[0].getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
            throw new AndroidRuntimeException(
                    "Calling startActivities() from outside of an Activity "
                    + " context requires the FLAG_ACTIVITY_NEW_TASK flag on first Intent."
                    + " Is this really what you want?");
        }
        mMainThread.getInstrumentation().execStartActivitiesAsUser(
        return mMainThread.getInstrumentation().execStartActivitiesAsUser(
                getOuterContext(), mMainThread.getApplicationThread(), null,
                (Activity) null, intents, options, userHandle.getIdentifier());
    }
+8 −3
Original line number Diff line number Diff line
@@ -1688,9 +1688,13 @@ public class Instrumentation {
     * {@link ActivityMonitor} objects only match against the first activity in
     * the array.
     *
     * @return The corresponding flag {@link ActivityManager#START_CANCELED},
     *         {@link ActivityManager#START_SUCCESS} etc. indicating whether the launch was
     *         successful.
     *
     * {@hide}
     */
    public void execStartActivitiesAsUser(Context who, IBinder contextThread,
    public int execStartActivitiesAsUser(Context who, IBinder contextThread,
            IBinder token, Activity target, Intent[] intents, Bundle options,
            int userId) {
        IApplicationThread whoThread = (IApplicationThread) contextThread;
@@ -1705,11 +1709,11 @@ public class Instrumentation {
                    }
                    if (result != null) {
                        am.mHits++;
                        return;
                        return ActivityManager.START_CANCELED;
                    } else if (am.match(who, null, intents[0])) {
                        am.mHits++;
                        if (am.isBlocking()) {
                            return;
                            return ActivityManager.START_CANCELED;
                        }
                        break;
                    }
@@ -1727,6 +1731,7 @@ public class Instrumentation {
                .startActivities(whoThread, who.getBasePackageName(), intents, resolvedTypes,
                        token, options, userId);
            checkStartActivityResult(result, intents[0]);
            return result;
        } catch (RemoteException e) {
            throw new RuntimeException("Failure from system", e);
        }
+2 −2
Original line number Diff line number Diff line
@@ -213,13 +213,13 @@ public class TaskStackBuilder {
     * Start the task stack constructed by this builder.
     * @hide
     */
    public void startActivities(Bundle options, UserHandle userHandle) {
    public int startActivities(Bundle options, UserHandle userHandle) {
        if (mIntents.isEmpty()) {
            throw new IllegalStateException(
                    "No intents added to TaskStackBuilder; cannot startActivities");
        }

        mSourceContext.startActivitiesAsUser(getIntents(), options, userHandle);
        return mSourceContext.startActivitiesAsUser(getIntents(), options, userHandle);
    }

    /**
+6 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.annotation.StyleableRes;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.IApplicationThread;
import android.app.IServiceConnection;
import android.app.VrManager;
@@ -1834,13 +1835,17 @@ public abstract class Context {
     * See {@link android.content.Context#startActivity(Intent, Bundle)}
     * Context.startActivity(Intent, Bundle)} for more details.
     *
     * @return The corresponding flag {@link ActivityManager#START_CANCELED},
     *         {@link ActivityManager#START_SUCCESS} etc. indicating whether the launch was
     *         successful.
     *
     * @throws ActivityNotFoundException  
     *
     * @see #startActivities(Intent[])
     * @see PackageManager#resolveActivity
     */
    @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL)
    public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
    public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

+2 −2
Original line number Diff line number Diff line
@@ -418,8 +418,8 @@ public class ContextWrapper extends Context {

    /** @hide */
    @Override
    public void startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
        mBase.startActivitiesAsUser(intents, options, userHandle);
    public int startActivitiesAsUser(Intent[] intents, Bundle options, UserHandle userHandle) {
        return mBase.startActivitiesAsUser(intents, options, userHandle);
    }

    @Override
Loading