The Android 12.0 system grants read and write permissions to third-party apps by default

1 Overview

 In the 12.0 system rom customization development, the read and write permissions are granted by default before 6.0, and the app does not need to apply for permissions. Before 10.0, it needs android.permission.WRITE_EXTERNAL_STORAGE and android.permission.READ_EXTERNAL_STORAGE
permissions. Time continues to strengthen the management of SD card reading and writing, and introduces the MANAGE_EXTERNAL_STORAGE permission, while the previous WRITE_EXTERNAL_STORAGE has expired.
And the MANAGE_EXTERNAL_STORAGE permission can only be applied for by jumping to the settings page.
12.0 needs to apply for permissions like this

App application permission

     if (sdk_Int >= 30) {
                    if (!Environment.isExternalStorageManager()) {
                        Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
                        startActivity(intent);
                        return;
                    }
                    writeAndReaderFile();
                    return;
                }

2. The core code part of the system granting read and write permissions to third-party apps

      frameworks/base/core/java/android/app/AppOpsManager.java

3. The core code part analysis and function realization of the read and write permissions granted by the system to third-party apps
  3.1AppOpsManager.j

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/130866274