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

Commit 7ff81067 authored by Mark Renouf's avatar Mark Renouf Committed by Android (Google) Code Review
Browse files

Merge "Refactoring to extract method for better readability"

parents 489577b7 7bb6a24e
Loading
Loading
Loading
Loading
+22 −19
Original line number Diff line number Diff line
@@ -248,7 +248,6 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
            ActivityManager.getService().resumeAppSwitches();
        } catch (RemoteException e) {
        }
        int launchResult;
        // If we are launching a work activity and require to launch
        // separate work challenge, we defer the activity action and cancel
        // notification until work challenge is unlocked.
@@ -277,24 +276,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
            fillInIntent = new Intent().putExtra(Notification.EXTRA_REMOTE_INPUT_DRAFT,
                    remoteInputText.toString());
        }
        RemoteAnimationAdapter adapter = mActivityLaunchAnimator.getLaunchAnimation(
                row, wasOccluded);
        try {
            if (adapter != null) {
                ActivityTaskManager.getService()
                        .registerRemoteAnimationForNextActivityStart(
                                intent.getCreatorPackage(), adapter);
            }
            launchResult = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
                    null, null, getActivityOptions(adapter));
            mActivityLaunchAnimator.setLaunchResult(launchResult, isActivityIntent);
        } catch (RemoteException | PendingIntent.CanceledException e) {
            // the stack trace isn't very helpful here.
            // Just log the exception message.
            Log.w(TAG, "Sending contentIntent failed: " + e);

            // TODO: Dismiss Keyguard.
        }
        startNotificationIntent(intent, fillInIntent, row, wasOccluded, isActivityIntent);
        if (isActivityIntent) {
            mAssistManager.hideAssist();
        }
@@ -327,6 +309,27 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
        mIsCollapsingToShowActivityOverLockscreen = false;
    }

    private void startNotificationIntent(PendingIntent intent, Intent fillInIntent,
            ExpandableNotificationRow row, boolean wasOccluded, boolean isActivityIntent) {
        RemoteAnimationAdapter adapter = mActivityLaunchAnimator.getLaunchAnimation(row,
                wasOccluded);
        try {
            if (adapter != null) {
                ActivityTaskManager.getService()
                        .registerRemoteAnimationForNextActivityStart(
                                intent.getCreatorPackage(), adapter);
            }
            int launchResult = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
                    null, null, getActivityOptions(adapter));
            mActivityLaunchAnimator.setLaunchResult(launchResult, isActivityIntent);
        } catch (RemoteException | PendingIntent.CanceledException e) {
            // the stack trace isn't very helpful here.
            // Just log the exception message.
            Log.w(TAG, "Sending contentIntent failed: " + e);
            // TODO: Dismiss Keyguard.
        }
    }

    @Override
    public void startNotificationGutsIntent(final Intent intent, final int appUid,
            ExpandableNotificationRow row) {