1.<uses-permission>:
Official Descriptive narrative:
If An application needs access to a feature protected by a permission, it must declare the IT requires that Permissio N with a<uses-permission>element in the manifest. Then, when the application was installed on the device, the installer determines whether or not to grant the requested Perm Ission by checking the authorities so signed the application ' s certificates and, in some cases, asking the user. If the permission is granted, the application are able to use the protected features. If not, it attempts to access those features would simply fail without any notification to the user.
Suppose an application needs to access an permission protected feature, the app must declare the permissions it needs in manifest with the <uses-permission> node. When the app is installed on the device, the installer will decide whether to grant it the permissions it declares. This sometimes asks the user. Assuming that the permission is granted, the application has the ability to use the protected feature. otherwise. Access failed and the user is not notified.
Note: It is not necessarily necessary to invoke other applications to declare <uses-permission>. Sometimes even the components that call their own app are declared!!
! (the sample below says)
2.<permission>:
an application can also protect its own components (activities, services, broadcast RECEIV ERS, and content providers) with permissions. It can employ any of the permissions defined by Android (listed Inandroid. Manifest.permission ) or declared by other applications. Or It can define its own. A new permission is declared with The <PERMISSION> &NBSP;ELEMENT.&NBSP;
An application can also protect its own components with permissions . It can use permissions defined by the Android system or other application-defined or self-defined applications. Suppose you want to define a new permission that can be defined with a <permission> node.
For example, the following:
<permission android:Description="string Resource" android:icon="drawable Resource" android:label="string Resource" android:name="string" android:Permissiongroup="string" android:ProtectionLevel=["Normal" | "Dangerous" | "Signature" | "Signatureorsystem"] />
For example, a activity could be protected as follows:
<manifest > <permission android:name= "Com.example.project.DEBIT_ACCT" .../> < Uses-permission android:name= "Com.example.project.DEBIT_ACCT"/> ... <application. .> <activity android:name= "com.example.project.FreneticActivity" android: permission= "Com.example.project.DEBIT_ACCT" ... > ... </activity> </application></manifest>
note that, in this example, The debit_acct permission is not a declared with The <PERMISSION> element, its use was also requested with The <USES-PERMISSION> element. Its use must is requested in order for other components of the application to launch the protected activity, even though T He protection is imposed by the application itself.
if, in the same example, The permission attribute is set to a permission declared elsewhere (such asandroid.permission.call_emergency_numbers , it would not has been necessary to declare it again With A<PERMISSION> element . However, it would still has been necessary to request its use With <USES-PERMISSION> .
The note is. In this example. Debit_acct This permission is not only declared in <permission>. And it is also stated in <uses-permission>. It is necessary to declare DEBIT_ACCT in <uses-permission> if the other component of this application launches this protected activity, even if this protection is added to the application itself. (This confirms the 1th said above).
Note that if the permission is defined elsewhere, it is not necessary to declare the <permission> again. However, this permission is still declared with <uses-permission>.
References:
Http://developer.android.com/guide/topics/manifest/manifest-intro.html#perms
http://berdy.iteye.com/blog/1782854
http://blog.csdn.net/lilu_leo/article/details/6940941
"Android" uses-permission and permission specific explanations