Android 12 Developer Preview 1 Changelog: Google Finally Restricts the Power of “adb backup”
And they possibly have a plan to remove this feature in the future.
A few months ago, I wrote a blog explaining the power of the command line
To summarize, “adb backup” is an official way to leak private data in certain apps. I said “official” because it’s designed and allowed by Android’s creator and there are also other unofficial ways to do it such as rooting a device.
With the Android 12 preview release, Google has announced a strong restriction (even a permanent removal in the future) of this command. It says that:
To help protect private app data, Android 12 changes the default behavior of the
adb backupcommand. For apps that target Android 12, when a user runs the
adb backupcommand, app data is excluded from any other system data that is exported from the device.
The statement is pretty clear: app data could no longer be extracted using
adb backupcommand. Let’s go check the change.
I have created a simple app which stores a token in a
val sp = getSharedPreferences("SharePreferenceApp", MODE_PRIVATE)
Don’t forget to set
At first, I check the command with
targetSdkVersion 30 to see whether it works. Indeed, with the command
adb backup com.example.backup
, I get the
SharePreference file in both Debug/Release mode.
If you don’t know how to use
adb backupcommand, feel free to refer to my previous blog.
Now, I change
"android-S" and try the command again.