Android 11 makes Google Photos annoying to use for some, but there may be a fix
We have no way of knowing how many devices on the market run Android 11 since Google no longer publishes distribution statistics, but there are probably tens of millions now that companies like Xiaomi and Samsung have had time to push the update to many of their models. If your device runs Android 11 and you use Google Photos, there’s a chance that you’ve encountered a rather annoying change with the way the app handles image deletion and restoration. Instead of simply selecting the images and videos you want to delete, hitting the trash can icon, and then tapping the “move to trash” button, you’ll now have to tap through an extra prompt to give Google Photos permission to delete or restore your files.
I had to withdraw from the Twitter Beta because scoped storage in Android 11 meant the Twitter app could no longer access anything in Photos.
With that fixed, it constantly asks me for permission to do anything & I can’t turn it off pic.twitter.com/SlYFJTpc0B
— Holly ‘8 Cats’ Brockwell (@holly) January 22, 2021
For those of you who take lots of photos and videos, it may be annoying to have to grant Google Photos permission to delete or restore a file. And as pointed out by AndroidPolice, tapping an extra button isn’t the only issue you may have to deal with. If you use Google Photos on another device and want to edit or trash a file you uploaded from your phone running Android 11, the app may ask you to review “out-of-sync changes”. That can quickly get annoying if Google Photos keeps asking you to review changes you just made on another platform.
I use the Web app a lot and now I have to approve all the changes I MADE MYSELF in the mobile app, and it takes ages for it to churn through them all.
It’s driving me mad pic.twitter.com/GuvBtaTecr
— Holly ‘8 Cats’ Brockwell (@holly) January 22, 2021
The extra step to delete or restore a file wasn’t required in Android 10 but is now required in Android 11 due to the enforcement of Scoped Storage. Before Scoped Storage, access to the entire external storage directory was managed by a single permission, making it hard for you to limit what apps can access your private documents, images, or videos. With Scoped Storage in place, Android limits how much access an app can have to sensitive files without explicit user consent. You can find more details on Scoped Storage in this article or look at Google’s graphic below for a summary of the changes.
While they were busy restricting storage access in Android 11, Google was also improving existing APIs to improve the user experience. For example, apps targeting Android 11 can use the MediaStore API to trash a file rather than delete it. In order to move a file to trash, though, the app has to prompt the user to grant it write access. Since most of the images and videos you add to Google Photos from your phone came from a different app — such as the stock camera app — Photos has to ask for permission before it can move a file to or from the trash. However, Google Photos doesn’t ask for permission to trash files if you’re using a Pixel phone with Android 11 installed. It does, however, ask for permission on basically every other device running Android 11, including most Samsung, Xiaomi, OnePlus, and ASUS devices. What gives?
The reason is that the system gallery app is not subjected to Scoped Storage restrictions. That means the stock gallery app can open, edit, or delete images and videos without explicit permission. Google Photos is preset as the system gallery app on Pixel phones, but most OEMs preset their own gallery app instead. Furthermore, there’s no user-facing setting to change the system gallery app, not even in Android’s “default apps” screen. However, there is a hidden way to change the system gallery app, but there’s one big caveat: Only a system application can be set as the system gallery app. That means only phones that already have Google Photos pre-installed as a system app can take advantage of this trick.
Not a lot of phones meet this criterion, but based on our testing, we can confirm this works on most OnePlus and some ASUS phones. This method didn’t work on any of the Samsung phones we tested it on, and it also didn’t work on a Xiaomi Mi 10 Pro. If you have root access or are running a custom ROM, this method may work on your device after you systemize the Google Photos app, but we only tested this method on stock devices.
How to (maybe) make Google Photos the system gallery app
Credits go to Kieron Quinn (Quinny899 on the XDA Forums) for sharing this trick!
adb shell cmd role add-role-holder android.app.role.SYSTEM_GALLERY com.google.android.apps.photos
If you don’t see an error, then it probably worked! You can quickly verify it worked by taking a photo and then trying to delete it in Google Photos. Alternatively, you can run the following command:
adb shell dumpsys role
…and check to see if the “holder” of “android.app.role.SYSTEM_GALLERY” is “com.google.android.apps.photos” (the package name of Google Photos).
What does this command do?
Android 10 added a new API called “Roles“. When an app has a certain role, it’s automatically granted access to certain permissions. For example, the SYSTEM_GALLERY role automatically grants an app “full read and write access to all image and video files on external storage, including access to location metadata.” The SYSTEM_GALLERY role can only be granted to system applications, and its default holder is defined by the Android configuration value “config_systemGallery.” As we explained earlier, most OEMs preset this value to the package name corresponding to their own gallery app. This value can’t be changed without either modifying the framework or installing an overlay, both of which require root access.
However, it is possible to add another app as a holder of the SYSTEM_GALLERY role, but only if that app is also a system app. This is possible on many OnePlus and some ASUS phones because these OEMs seemingly preinstalled Google Photos on the system-level rather than user-level. Because of this, the Google Photos app is eligible to hold the SYSTEM_GALLERY role, and we take advantage of Android’s hidden RoleManager shell interface to grant it access to permissions it normally can’t be granted. If you attempt to grant the SYSTEM_GALLERY role to a non-system app, you’ll see the following error in logcat:
E RoleControllerServiceImpl: Package does not qualify for the role, package: com.google.android.apps.photos, role: android.app.role.SYSTEM_GALLERY
Sadly, we haven’t found a way around this limitation, but if we do, we’ll share our method with the community. Of course, we would prefer that Google simply make the SYSTEM_GALLERY role user-definable rather than limited to the OEM’s choice.