Android 11 introduced a new file accessing API, Scoped Storage. It essentially doesn't allow apps to access all files on your phone anymore, which is great for security. However, Scoped Storage also comes with some unwanted consequences. Non-Pixel phones running Android 11 have to ask users to confirm that they want to delete or restore images in Google Photos since the app isn't allowed to delete and restore files without explicit user consent anymore. Luckily, there's a fix for some phones.

The problem

If you use Google Photos on Android 11, you may have already run into the new "Allow Photos to move this photo to trash" prompt when you want to delete something. That's because apps targeting the latest Android version need an explicit user confirmation before they're allowed to move, edit, or delete files. While that new prompt isn't too big of a deal, the problem becomes more severe when you routinely edit and delete photos somewhere else, like on a tablet or the Google Photos web interface. Google Photos will then pester you with a "Review out-of-sync changes" toast on your Android 11 phone, asking you to confirm the changes you've made before they appear on your phone.

Read more about the problem in our deep dive on what's going on.

The solution

Luckily, there are some exemptions from Scoped Storage. The rules are different for default apps like launchers, browsers, SMS apps, and others — they're allowed to edit and delete some files without explicit user permission. The same is true for the default pre-installed gallery app, which is why you don't have to worry about confirming deleted photos on Pixel phones (they ship with Photos as the default app). However, unlike for browsers and launchers, there's no setting that allows you to change the default gallery app, and most if not all third-party manufacturers make their own gallery app the default one, leaving Google Photos out in the cold when it comes to trashing files without user consent. Thankfully, there's an ADB shell command that allows you to change the default gallery app, first spotted by Android dev Kieron Quinn and XDA.

But before we dive into the steps you have to take, you need to know that this workaround isn't available on all phones. It only works on handsets that ship with Google Photos as a system app, not a user-level app. That's the case for most OnePlus phones and a few Asus handsets. The great majority of devices ship Photos as a user-level app, though, including many popular Samsung and Xiaomi models, so the trick won't work on these. You can still give the workaround a try to see if Photos is a system app on phones from other manufacturers — nothing will break if that isn't the case, you'll only get an error message.

To get started, you need to set up the ADB shell, the Android Developer Bridge shell that allows you to send some advanced commands to your phone. We've got a tutorial on how that's done. Once everything is set up, you need to run the following command (copy and paste it into your terminal and hit enter):

adb shell cmd role add-role-holder

If you use the Local ADB Shell app or WebADB, leave out 'adb shell' in front of the command.

Once you've executed the command and you haven't received an error message, test if everything works as expected by snapping a photo with your camera and then deleting it with Google Photos. You shouldn't see the "Allow Photos to move this photo to trash" prompt any longer.

While Scoped Storage is more than welcome in terms of security, there are some quirks inherent to how the new file storage API works, and it's a bummer the Photos problem can't be fixed on all phones. Let's hope Google considers adding an option for setting a default gallery app in a future version of Android, as that's likely the simplest solution for any photos syncing service. Another option would be giving Photos a Scoped Storage exemption in the future, granting it full access to storage.