Android 11 makes using Google Photos boring, but there may be a fix


We have no way of knowing how many devices on the market are using Android 11 since Google no longer publishes distribution stats, but there are probably tens of millions now that companies like Xiaomi and Samsung have had the. time to push the update on many of their models. If your device is running Android 11 and you’re using Google Photos, you may have come across a rather annoying change in the way the app handles deleting and restoring images. Instead of just selecting the images and videos you want to delete, hitting the trash can icon, and then hitting the ‘move to trash’ button, you will now need to hit an additional prompt to allow Google Photos to delete or restore your files.

For those of you who take a lot of photos and videos, having to allow Google Photos to delete or restore a file can be annoying. And as pointed out by AndroidPolice, pushing an extra button isn’t the only problem you might have to solve. If you’re using Google Photos on another device and want to edit or delete a file you’ve uploaded from your Android 11 phone, the app may ask you to review “unsynchronized changes”. It can quickly get annoying if Google Photos keeps asking you to review the changes you just made on another platform.

The extra step to delete or restore a file was not required in Android 10, but is now required in Android 11 due to the application of Scoped Storage. Before Scoped Storage, access to the entire external storage directory was handled by a single permission, preventing you from restricting which apps can access your private documents, images, or videos. With Scoped Storage in place, Android restricts the access an app can have to sensitive files without the user’s explicit consent. You can find more details about Scoped Storage in this article or check out the Google chart below for a summary of the changes.

Android 11 extended storage summary

While they were busy restricting access to storage in Android 11, Google was also improving existing APIs to improve user experience. For example, apps targeting Android 11 can use the MediaStore API to delete a file rather than deleting it. However, to move a file to the recycle bin, the application must prompt the user to grant it write access. Since most of the images and videos you add to Google Photos from your phone are from another app, such as the stock camera app, Photos must ask for permission before you can move a file to. or from the recycle bin. However, Google Photos doesn’t ask for permission to delete files if you’re using a Pixel phone with Android 11 installed. However, it asks for permission on pretty much every other device running Android 11, including most Samsung, Xiaomi, OnePlus, and ASUS devices. Which give?

The reason is that the system gallery app is not subject to limited storage restrictions. This means that the stock gallery app can open, edit or delete images and videos without explicit permission. Google Photos comes preset as the system gallery app on Pixel phones, but most OEMs have their own preset gallery app preset instead. Additionally, there is no user 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 is one large caveat: Only a system app can be set as a system gallery app. This means that the phones Google Photos is already preinstalled as a system app can take advantage of this trick.

Few phones meet this criterion, but based on our tests, we can confirm it 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 didn’t work on a Xiaomi Mi 10 Pro either. If you have root access or are running a custom ROM, this method may work on your device after systematizing the Google Photos app, but we only tested this method on stock devices.

How (maybe) to make Google Photos the system gallery app

Credits go to Kieron Quinn (Quinny899 on the XDA Forums) for sharing this tip!

The first thing to do is to install ADB on your PC. We have an updated guide on how to do this here. Once you have configured ADB, enter the following command:

adb shell cmd role add-role-holder

If you don’t see an error, it probably worked! You can quickly verify that it worked by taking a photo and then trying to delete it in Google Photos. You can also run the following command:

adb shell dumpsys role

… And check if the “owner” of “” is “” (the name of the Google Photos package).

If your output matches the highlighted text in the red rectangle, it worked.

What does this command do?

Android 10 added a new API called “Roles”. When an application has a certain role, it automatically has access to certain permissions. For example, the SYSTEM_GALLERY role automatically grants an application “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 cannot be changed without modifying the framework or installing an overlay, both of which require root access.

However, he is possible to add another application as holder of the SYSTEM_GALLERY role, but only if this application is also a system application. This is possible on many OnePlus and some ASUS phones, as these OEMs apparently preinstalled Google Photos at the system level rather than at the user level. For this reason, 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 that are not normally granted to it. If you try to grant the SYSTEM_GALLERY role to a non-system application, you will see the following error in logcat:

E RoleControllerServiceImpl: Package does not qualify for the role, package:, role:

Unfortunately, we haven’t found a way to work around this limitation, but if we do, we’ll share our method with the community. Of course, we would prefer that Google just make the SYSTEM_GALLERY role user-definable rather than limited to the OEM’s choice.

Source link