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

Commit 4dd3f113 authored by Arc Wang's avatar Arc Wang
Browse files

Fix not able to add Settings shortcut widget problem

After users select a shortcut item in CreateShortcutActivity,
launchers need to get result from CreateShortcutActivity.

For large screen devices, Settings deep link will start
DeepLinkHomepageActivity and then DeepLinkHomepageActivity
starts the deep link page. The CreateShortcutActivity result
deos not forward to launcher and there is no shortcut added.

This change uses Intent.FLAG_ACTIVITY_FORWARD_RESULT to
forward result from CreateShortcutActivity to launcher.

Bug: 200889769
Test: manual
      Long click launcher -> Widget -> Settings ->
      select an item and check if it adds a short on launcher.
Change-Id: Idd5fc642be5c1fb2f747316c3ddcd9b7f0b33852
parent 4223ee98
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -384,6 +384,7 @@ public class SettingsActivity extends SettingsBaseActivity
        trampolineIntent.putExtra(
        trampolineIntent.putExtra(
                android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
                android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
                intent.toUri(Intent.URI_INTENT_SCHEME));
                intent.toUri(Intent.URI_INTENT_SCHEME));
        trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
        startActivity(trampolineIntent);
        startActivity(trampolineIntent);


        return true;
        return true;
+1 −0
Original line number Original line Diff line number Diff line
@@ -212,6 +212,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
        intent.setAction(null);
        intent.setAction(null);


        targetIntent.setFlags(targetIntent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
        targetIntent.setFlags(targetIntent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
        targetIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);


        // Sender of intent may want to send intent extra data to the destination of targetIntent.
        // Sender of intent may want to send intent extra data to the destination of targetIntent.
        targetIntent.replaceExtras(intent);
        targetIntent.replaceExtras(intent);