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

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

Merge changes from topics "presubmit-am-0adc4a89a1534fb8873a721309ac084a",...

Merge changes from topics "presubmit-am-0adc4a89a1534fb8873a721309ac084a", "presubmit-am-f0e20c2f5d9d42f5b21d0cb6ae2e15cd" into tm-dev

* changes:
  Removes 'mIsHeadlessSpringboardActivity'
  Remove 'startAsCallerImpl' refactoring relic
parents 8089e6f2 3782660d
Loading
Loading
Loading
Loading
+0 −82
Original line number Diff line number Diff line
@@ -152,18 +152,6 @@ public class ChooserActivity extends ResolverActivity implements
        SelectableTargetInfoCommunicator {
    private static final String TAG = "ChooserActivity";

    /**
     * Whether this chooser is operating in "headless springboard" mode (as determined during
     * onCreate). In this mode, our activity sits in the background and waits for the new
     * "unbundled" chooser to handle the Sharesheet experience; the system ChooserActivity is
     * responsible only for providing the startActivityAsCaller permission token and keeping it
     * valid for the life of the unbundled delegate activity.
     *
     * TODO: when the unbundled chooser is fully launched, the system-side "springboard" can use a
     * simpler implementation that doesn't inherit from ResolverActivity.
     */
    private boolean mIsHeadlessSpringboardActivity;

    private AppPredictor mPersonalAppPredictor;
    private AppPredictor mWorkAppPredictor;
    private boolean mShouldDisplayLandscape;
@@ -259,11 +247,6 @@ public class ChooserActivity extends ResolverActivity implements

    private static final float DIRECT_SHARE_EXPANSION_RATE = 0.78f;

    private boolean mEnableChooserDelegate =
            DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
                    SystemUiDeviceConfigFlags.USE_DELEGATE_CHOOSER,
                    false);

    private static final int DEFAULT_SALT_EXPIRATION_DAYS = 7;
    private int mMaxHashSaltDays = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI,
            SystemUiDeviceConfigFlags.HASH_SALT_MAX_DAYS,
@@ -530,12 +513,6 @@ public class ChooserActivity extends ResolverActivity implements

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (handOverToDelegateChooser()) {
            super_onCreate(savedInstanceState);
            mIsHeadlessSpringboardActivity = true;
            return;
        }

        final long intentReceivedTime = System.currentTimeMillis();
        getChooserActivityLogger().logSharesheetTriggered();
        // This is the only place this value is being set. Effectively final.
@@ -751,56 +728,6 @@ public class ChooserActivity extends ResolverActivity implements
        postponeEnterTransition();
    }

    private boolean handOverToDelegateChooser() {
        // Check the explicit classname so that we don't interfere with the flow of any subclasses.
        if (!this.getClass().getName().equals("com.android.internal.app.ChooserActivity")
                || !mEnableChooserDelegate) {
            return false;
        }

        Intent delegationIntent = new Intent();
        final ComponentName delegateActivity = ComponentName.unflattenFromString(
                Resources.getSystem().getString(R.string.config_chooserActivity));
        delegationIntent.setComponent(delegateActivity);
        delegationIntent.putExtra(Intent.EXTRA_INTENT, getIntent());
        delegationIntent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);

        // Don't close until the delegate finishes, or the token will be invalidated.
        mAwaitingDelegateResponse = true;
        startActivityForResult(delegationIntent, REQUEST_CODE_RETURN_FROM_DELEGATE_CHOOSER);
        return true;
    }

    @Override
    protected void onRestart() {
        if (mIsHeadlessSpringboardActivity) {
            super_onRestart();
            return;
        }

        super.onRestart();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        if (mIsHeadlessSpringboardActivity) {
            super_onSaveInstanceState(outState);
            return;
        }

        super.onSaveInstanceState(outState);
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        if (mIsHeadlessSpringboardActivity) {
            super_onRestoreInstanceState(savedInstanceState);
            return;
        }

        super.onRestoreInstanceState(savedInstanceState);
    }

    @Override
    protected int appliedThemeResId() {
        return R.style.Theme_DeviceDefault_Chooser;
@@ -1059,11 +986,6 @@ public class ChooserActivity extends ResolverActivity implements

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (mIsHeadlessSpringboardActivity) {
            super_onConfigurationChanged(newConfig);
            return;
        }

        super.onConfigurationChanged(newConfig);
        ViewPager viewPager = findViewById(R.id.profile_pager);
        if (viewPager.isLayoutRtl()) {
@@ -1616,10 +1538,6 @@ public class ChooserActivity extends ResolverActivity implements
    protected void onDestroy() {
        super.onDestroy();

        if (mIsHeadlessSpringboardActivity) {
            return;
        }

        if (mRefinementResultReceiver != null) {
            mRefinementResultReceiver.destroy();
            mRefinementResultReceiver = null;
+0 −9
Original line number Diff line number Diff line
@@ -1458,15 +1458,6 @@ public class ResolverActivity extends Activity implements
                .write();
    }


    public boolean startAsCallerImpl(Intent intent, Bundle options, boolean ignoreTargetSecurity,
            int userId) {
        // Note: this method will be overridden in the delegate implementation to use the passed-in
        // permission token.
        startActivityAsCaller(intent, options, false, userId);
        return true;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
+2 −3
Original line number Diff line number Diff line
@@ -173,9 +173,8 @@ public class DisplayResolveInfo implements TargetInfo, Parcelable {

    @Override
    public boolean startAsCaller(ResolverActivity activity, Bundle options, int userId) {
        // TODO: if the start-as-caller API no longer requires a permission token, this can go back
        // to inlining the real activity-start call, and we can remove startAsCallerImpl.
        return activity.startAsCallerImpl(mResolvedIntent, options, false, userId);
        activity.startActivityAsCaller(mResolvedIntent, options, false, userId);
        return true;
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -241,7 +241,8 @@ public final class SelectableTargetInfo implements ChooserTargetInfo {
        final boolean ignoreTargetSecurity = mSourceInfo != null
                && mSourceInfo.getResolvedComponentName().getPackageName()
                .equals(mChooserTarget.getComponentName().getPackageName());
        return activity.startAsCallerImpl(intent, options, ignoreTargetSecurity, userId);
        activity.startActivityAsCaller(intent, options, ignoreTargetSecurity, userId);
        return true;
    }

    @Override