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

Commit edd91138 authored by Mark Renouf's avatar Mark Renouf Committed by Android Build Coastguard Worker
Browse files

Prevent Sharing when FRP enforcement is in effect

ADB command to trigger sharing:

```
adb shell 'am start -a android.intent.action.CHOOSER --eu android.intent.extra.INTENT "intent:#Intent;action=android.intent.action.SEND;type=text/plain;S.android.intent.extra.TEXT=Shared%20text;end"'
```

Bug: 327645387
Test: manual; trigger FRP; attempt to open share sheet using adb
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5080af26387a18d5638d5a42eadfb8d4d700518c)
Merged-In: I1db78ab74babe71b516f601be35cf476b5e43271
Change-Id: I1db78ab74babe71b516f601be35cf476b5e43271
parent ffaac4a5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -600,6 +600,14 @@ public class ChooserActivity extends ResolverActivity implements

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (Settings.Secure.getIntForUser(getContentResolver(),
                Settings.Secure.SECURE_FRP_MODE, 0,
                getUserId()) == 1) {
            Log.e(TAG, "Sharing disabled due to active FRP lock.");
            super.onCreate(savedInstanceState);
            finish();
            return;
        }
        final long intentReceivedTime = System.currentTimeMillis();
        getChooserActivityLogger().logSharesheetTriggered();
        // This is the only place this value is being set. Effectively final.