Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 5 min read

How to revoke Facebook's gallery access on Android (Settings + adb check)

I don't like the idea of any social app holding a permanent key to my whole camera roll, so I went through Facebook's media permission on my Android phone and checked the result with adb instead of trusting the toggle bl

I don't like the idea of any social app holding a permanent key to my whole camera roll, so I went through Facebook's media permission on my Android phone and checked the result with adb instead of trusting the toggle blindly. The whole thing took me under ten minutes, and it's basic-level work β€” no root, no modding. Here is the exact sequence, plus the commands I used to confirm the change stuck.

What you need before you start

  • An unlocked Android phone with Facebook installed and signed in.
  • Access to Settings > Apps. If Facebook sits in a work profile, repeat every step inside that profile too β€” permissions are per-profile.
  • Optional but handy: a USB cable, USB debugging enabled, and Android Platform Tools installed, so you can verify with adb rather than guessing.
  • Optional: the Facebook package name. Don't assume it β€” list the packages first.

Manufacturers rename screens all the time, so if a label in this guide doesn't match your build, search Settings for Facebook and photos, or check your device documentation.

Worth separating three controls that people mix up:

Control Typical label What it actually controls
Gallery/media permission Photos and videos, or Files and media Standing access to your photo library
System photo picker Selected photos / photo picker Only the items you hand over for one upload
Camera permission Camera Taking new photos, not reading existing ones

If you're going the adb route, confirm the toolchain first:

adb version
adb devices

You want a version line from the first command, and your phone listed as device by the second. If it says unauthorized, unlock the phone and accept the RSA prompt.

Step 1: Pin down the package and the permission name

Start by finding out which Facebook build you're dealing with:

adb shell pm list packages | grep -i facebook

A typical result looks like this:

package:com.facebook.katana
package:com.facebook.lite

Pick the one matching the app you're restricting β€” com.facebook.katana is the full app in that example, com.facebook.lite is Lite. Then see which media permission your Android build actually exposes:

adb shell dumpsys package com.facebook.katana | grep -E "READ_MEDIA|READ_EXTERNAL_STORAGE|ACCESS_MEDIA_LOCATION"

This matters because permission names aren't identical across Android versions. Newer builds use READ_MEDIA_IMAGES, while older ones fall back to READ_EXTERNAL_STORAGE. Confirming the name first saves you from applying a rule the device silently ignores.

You can cross-check by hand: open Settings > Apps > See all apps > Facebook > Permissions. There should be an entry like Photos and videos or Files and media. If the screen says No permissions requested, Facebook has no standing media grant on that profile and there's nothing to revoke there.

Step 2: Deny gallery access in Android Settings

Go to Settings > Apps > See all apps > Facebook > Permissions > Photos and videos and choose Don't allow. On builds that call it Files and media, open that row and deny it the same way.

One gotcha: some builds only offer Allow all and Select photos. Picking Select photos and adding nothing is a partial restriction, not a full denial β€” be aware of the difference. Afterwards, go back to the permission screen and confirm the media row no longer reads Allowed.

For a scriptable check, appops works on many builds. Read the current state first:

adb shell appops get com.facebook.katana READ_MEDIA_IMAGES

On a denied app you should see:

READ_MEDIA_IMAGES: deny

To deny it from the command line where the operation is supported:

adb shell appops set com.facebook.katana READ_MEDIA_IMAGES deny
adb shell appops set com.facebook.katana READ_MEDIA_VIDEO deny

If the operation name comes back as unknown, use whatever Step 1 printed β€” an older build may need READ_EXTERNAL_STORAGE instead. And if appops rejects the command outright, fall back to the Settings path rather than assuming it worked.

Step 3: Force-stop, clear cache, then test an upload

Settings changes can linger in a running process, so kill it:

adb shell am force-stop com.facebook.katana

Then clear cached thumbnails via Settings > Apps > See all apps > Facebook > Storage & cache > Clear cache. Don't tap Clear storage unless you're fine with being signed out.

Now open Facebook and start a photo upload. What you want to see is the Android system picker β€” not an unrestricted gallery grid rendered inside Facebook. My checklist:

  • [ ] Settings > Apps > Facebook > Permissions shows the media permission as denied.
  • [ ] adb shell appops get com.facebook.katana READ_MEDIA_IMAGES returns deny, or the equivalent name from Step 1 does.
  • [ ] A photo upload opens the system picker and asks me to choose individual items.
  • [ ] No full-library prompt appears; if one does, deny it again.

The picker test is the real proof, because it shows the difference between standing gallery access and a one-off selection you make yourself.

When something doesn't behave

adb doesn't see the phone. The error is device unauthorized and the cause is almost always an unaccepted RSA dialog. Unlock the device, tap Allow, then run adb kill-server && adb start-server && adb devices. You want device, not unauthorized.

appops rejects the media operation. Error: Unknown operation string: READ_MEDIA_IMAGES means that name doesn't exist on your build, or it uses the older storage permission. Re-run the dumpsys grep from Step 1 and use the reported name, for example adb shell appops set com.facebook.katana READ_EXTERNAL_STORAGE deny. Still rejected? Do it in Settings and verify there.

Settings says no media permission, but old photos still show up. Either you're looking at a different package or profile (Facebook Lite, Messenger, or a work-profile copy), or you're seeing cached images. List packages again, repeat the denial on the matching one, then force-stop and clear the cache.

Quick answers

Does denying Photos and videos stop Facebook from uploading screenshots? No β€” it removes standing access to the library. You can still hand over an individual screenshot through the system picker, deliberately, one file at a time. That's the point: access becomes something you grant per upload instead of something the app keeps forever.

Takeaway

The permission toggle is the gate that matters, but verifying it takes thirty seconds and saves a lot of doubt: deny the media permission in Settings, confirm the state with appops, force-stop the app, clear the cache, and then watch which picker opens. Running the same audit across your other apps is a good next habit.

This article was originally published on AI Release β€” https://ai-release.org. If you want more guides like this one, the channel is at https://t.me/ai_release1.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.