Android-入门教程-内部存储/外部存储-权限篇

AndroidManifest.xml - OpenGrok cross reference for /frameworks/base/core/res/AndroidManifest.xml

902     <!-- ====================================================================== -->
903     <!-- Permissions for accessing external storage                             -->
904     <!-- ====================================================================== -->
905     <eat-comment />
906 
907     <!-- Used for runtime permissions related to the shared external storage. -->
908     <permission-group android:name="android.permission-group.STORAGE"
909         android:icon="@drawable/perm_group_storage"
910         android:label="@string/permgrouplab_storage"
911         android:description="@string/permgroupdesc_storage"
912         android:priority="900" />
913 
914     <!-- Allows an application to read from external storage.
915       <p>Any app that declares the {@link #WRITE_EXTERNAL_STORAGE} permission is implicitly
916       granted this permission.</p>
917       <p>This permission is enforced starting in API level 19.  Before API level 19, this
918       permission is not enforced and all apps still have access to read from external storage.
919       You can test your app with the permission enforced by enabling <em>Protect USB
920       storage</em> under Developer options in the Settings app on a device running Android 4.1 or
921       higher.</p>
922       <p>Also starting in API level 19, this permission is <em>not</em> required to
923       read/write files in your application-specific directories returned by
924       {@link android.content.Context#getExternalFilesDir} and
925       {@link android.content.Context#getExternalCacheDir}.
926       <p class="note"><strong>Note:</strong> If <em>both</em> your <a
927       href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
928       minSdkVersion}</a> and <a
929       href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
930       targetSdkVersion}</a> values are set to 3 or lower, the system implicitly
931       grants your app this permission. If you don't need this permission, be sure your <a
932       href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
933       targetSdkVersion}</a> is 4 or higher.
934 
935       <p> This is a soft restricted permission which cannot be held by an app it its
936       full form until the installer on record whitelists the permission.
937       Specifically, if the permission is allowlisted the holder app can access
938       external storage and the visual and aural media collections while if the
939       permission is not allowlisted the holder app can only access to the visual
940       and aural medial collections. Also the permission is immutably restricted
941       meaning that the allowlist state can be specified only at install time and
942       cannot change until the app is installed. For more details see
943       {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}.
944      <p>Protection level: dangerous -->
945     <permission android:name="android.permission.READ_EXTERNAL_STORAGE"
946         android:permissionGroup="android.permission-group.UNDEFINED"
947         android:label="@string/permlab_sdcardRead"
948         android:description="@string/permdesc_sdcardRead"
949         android:permissionFlags="softRestricted|immutablyRestricted"
950         android:protectionLevel="dangerous" />
951 
952     <!-- Allows an application to write to external storage.
953          <p class="note"><strong>Note:</strong> If <em>both</em> your <a
954          href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
955          minSdkVersion}</a> and <a
956          href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
957          targetSdkVersion}</a> values are set to 3 or lower, the system implicitly
958          grants your app this permission. If you don't need this permission, be sure your <a
959          href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
960          targetSdkVersion}</a> is 4 or higher.
961          <p>Starting in API level 19, this permission is <em>not</em> required to
962          read/write files in your application-specific directories returned by
963          {@link android.content.Context#getExternalFilesDir} and
964          {@link android.content.Context#getExternalCacheDir}.
965          <p>If this permission is not allowlisted for an app that targets an API level before
966          {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p>
967          <p>Protection level: dangerous</p>
968     -->
969     <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
970         android:permissionGroup="android.permission-group.UNDEFINED"
971         android:label="@string/permlab_sdcardWrite"
972         android:description="@string/permdesc_sdcardWrite"
973         android:permissionFlags="softRestricted|immutablyRestricted"
974         android:protectionLevel="dangerous" />
975 
976     <!-- Allows an application to access any geographic locations persisted in the
977          user's shared collection.
978          <p>Protection level: dangerous -->
979     <permission android:name="android.permission.ACCESS_MEDIA_LOCATION"
980         android:permissionGroup="android.permission-group.UNDEFINED"
981         android:label="@string/permlab_mediaLocation"
982         android:description="@string/permdesc_mediaLocation"
983         android:protectionLevel="dangerous" />
984 
985     <!-- @hide @SystemApi @TestApi
986          Allows an application to modify OBB files visible to other apps. -->
987     <permission android:name="android.permission.WRITE_OBB"
988         android:protectionLevel="signature|privileged" />
989 
990     <!-- Allows an application a broad access to external storage in scoped storage.
991          Intended to be used by few apps that need to manage files on behalf of the users.
992          <p>Protection level: signature|appop|preinstalled -->
993     <permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
994         android:permissionGroup="android.permission-group.UNDEFINED"
995         android:protectionLevel="signature|appop|preinstalled" />
996 
997     <!-- Allows an application to modify and delete media files on this device or any connected
998          storage device without user confirmation. Applications must already be granted the
999          {@link #READ_EXTERNAL_STORAGE} or {@link #MANAGE_EXTERNAL_STORAGE}} permissions for this
1000          permission to take effect.
1001          <p>Even if applications are granted this permission, if applications want to modify or
1002          delete media files, they also must get the access by calling
1003          {@link android.provider.MediaStore#createWriteRequest(ContentResolver, Collection)},
1004          {@link android.provider.MediaStore#createDeleteRequest(ContentResolver, Collection)}, or
1005          {@link android.provider.MediaStore#createTrashRequest(ContentResolver, Collection, boolean)}.
1006          <p>This permission doesn't give read or write access directly. It only prevents the user
1007          confirmation dialog for these requests.
1008          <p>If applications are not granted {@link #ACCESS_MEDIA_LOCATION}, the system also pops up
1009          the user confirmation dialog for the write request.
1010          <p>Protection level: signature|appop|preinstalled -->
1011     <permission android:name="android.permission.MANAGE_MEDIA"
1012         android:protectionLevel="signature|appop|preinstalled" />

Manifest.permission  |  Android Developers

  • android.permission.READ_EXTERNAL_STORAGE
  • android.permission.WRITE_EXTERNAL_STORAGE
  • android.permission.ACCESS_MEDIA_LOCATION
  • android.permission.MANAGE_EXTERNAL_STORAGE
  • android.permission.MANAGE_MEDIA


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值