1 / 12

Programming the Android Platform

Permissions. Programming the Android Platform. Permission Architecture. Applications can protect resources & data with permissions Applications statically declare permissions Required of components interacting with them Required by components they interact with

thad
Télécharger la présentation

Programming the Android Platform

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Permissions Programming the Android Platform

  2. Permission Architecture • Applications can protect resources & data with permissions • Applications statically declare permissions • Required of components interacting with them • Required by components they interact with • Android requires users for consent to specific permissions when application is installed

  3. Defining Permissions • Applications can define permissions in an AndroidManifest.xml file <!-- Allows access to the vibrator --> <permission android:name="android.permission.VIBRATE” … />

  4. Requiring Application Permissions • Applications can require components interacting with them to have a specified permission by setting android:permission attribute in AndroidManifest.xml • By default, permissions apply to all components hosted by the application

  5. Requiring Application Perms (cont.) • AndroidManifest.xml <application android:permission=“android.permission.VIBRATE” . . .> … </application>

  6. Component Permissions • Individual components can set their own permissions • These override application-level permissions

  7. Activity Permissions • Restricts which components can start the associated activity • Checked during • Context.startActivity() • Activity.startActivityForResult() • Throws SecurityException on permissions failure

  8. Service Permissions • Restricts which components can start or bind to the associated service • Checked during • Context.startService() • Context.stopService() • Context.bindService() • Throws SecurityException on permissions failure

  9. BroadcastReceiver Permissions • Restricts which components can send broadcasts to the associated receiver • Checked afterContext.sendBroadcast() returns • Doesn’t throw SecurityException on permissions failure

  10. ContentProviderPermissions • Restricts which components can read and write the data in a ContentProvider • Will discuss in more detail later, when we cover ContentProviders

  11. Declaring Permissions • Applications specify permissions they use <application … > …<uses-permission android:name="android.permission.VIBRATE”></uses-permission> … </application> • User must accept permissions before the package can be installed

  12. Fine-Grained Permissions • Who can receive Broadcast Intents • Context.sendBroadcast() • Can a calling process access a Service • Context.checkCallingPermission() • Does a given processes have specific permissions • Context.checkPermission(String, int, int) • Does a given application have specific permissions • PackageManager.checkPermission(String, String) • Any others to be discussed in later lectures

More Related