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

Commit 38190138 authored by Martijn Coenen's avatar Martijn Coenen Committed by Himanshu Dagar
Browse files

Redirect ACTION_MEDIA_SCANNER_SCAN file to owner user.

When an app that shares media with its parent sends an intent to scan a
file, it should be handled by the parent user of the profile, not the
profile user itself.

Bug: 177288787
Bug: 189534381
Test: manual
Change-Id: I4147d65a8d11009b58b6c2faab04af660105b846
parent b0126b10
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -393,6 +393,7 @@ import com.android.server.graphics.fonts.FontManagerInternal;
import com.android.server.job.JobSchedulerInternal;
import com.android.server.os.NativeTombstoneManager;
import com.android.server.pm.Installer;
import com.android.server.pm.UserManagerInternal;
import com.android.server.pm.parsing.pkg.AndroidPackage;
import com.android.server.pm.permission.PermissionManagerServiceInternal;
import com.android.server.uri.GrantUri;
@@ -13308,6 +13309,14 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
            switch (action) {
                case Intent.ACTION_MEDIA_SCANNER_SCAN_FILE:
                    UserManagerInternal umInternal = LocalServices.getService(
                            UserManagerInternal.class);
                    UserInfo userInfo = umInternal.getUserInfo(userId);
                    if (userInfo != null && userInfo.isCloneProfile()) {
                        userId = umInternal.getProfileParentId(userId);
                    }
                    break;
                case Intent.ACTION_UID_REMOVED:
                case Intent.ACTION_PACKAGE_REMOVED:
                case Intent.ACTION_PACKAGE_CHANGED: