diff --git a/docs/html/guide/topics/manifest/manifest-intro.jd b/docs/html/guide/topics/manifest/manifest-intro.jd index c843567488e5c..851674c0f7805 100644 --- a/docs/html/guide/topics/manifest/manifest-intro.jd +++ b/docs/html/guide/topics/manifest/manifest-intro.jd @@ -6,50 +6,53 @@ page.title=App Manifest

In this document

    -
  1. Structure of the Manifest File
  2. -
  3. File Conventions -
  4. File Features -
      -
    1. Intent Filters
    2. -
    3. Icons and Labels
    4. -
    5. Permissions
    6. -
    7. Libraries
    8. -
  5. +
  6. Manifest file structure
  7. +
  8. File conventions +
  9. File features +
      +
    1. Intent filters
    2. +
    3. Icons and labels
    4. +
    5. Permissions
    6. +
    7. Libraries
    8. +

- Every application must have an AndroidManifest.xml file (with precisely that + Every application must have an {@code AndroidManifest.xml} file (with precisely that name) in its root directory. The manifest file - presents essential information about your app to the Android system, - information the system must have before it can run any of the app's - code. Among other things, the manifest does the following: + provides essential information about your app to the Android system, which + the system must have before it can run any of the app's + code. +

+ +

+Among other things, the manifest file does the following:

+

Note: As you prepare your Android app to run on Chromebooks, +there are some important hardware and software feature limitations that you should consider. See +the +App Manifest Compatibility for Chromebooks document for more information. +

-

Structure of the Manifest File

+

Manifest file structure

-The diagram below shows the general structure of the manifest file and -every element that it can contain. Each element, along with all of its -attributes, is documented in full in a separate file. To view detailed -information about any element, click on the element name in the diagram, -in the alphabetical list of elements that follows the diagram, or on any -other mention of the element name. +The code snippet below shows the general structure of the manifest file and +every element that it can contain. Each element, along with all of its +attributes, is fully documented in a separate file. +

+ +

Tip: To view detailed +information about any of the elements that are mentioned within the text of this document, +simply click the element name. +

+ +

+Here is an example of the manifest file:

@@ -126,45 +140,45 @@ other mention of the element name.
 

-All the elements that can appear in the manifest file are listed below -in alphabetical order. These are the only legal elements; you cannot +The following list contains all of the elements that can appear in the manifest file, +in alphabetical order: +

+ + + +

Note: These are the only legal elements – you cannot add your own elements or attributes.

-

-<action> -
<activity> -
<activity-alias> -
<application> -
<category> -
<data> -
<grant-uri-permission> -
<instrumentation> -
<intent-filter> -
<manifest> -
<meta-data> -
<permission> -
<permission-group> -
<permission-tree> -
<provider> -
<receiver> -
<service> -
<supports-screens> -
<uses-configuration> -
<uses-feature> -
<uses-library> -
<uses-permission> -
<uses-sdk> -

- - - - -

File Conventions

+

File conventions

-Some conventions and rules apply generally to all elements and attributes -in the manifest: +This section describes the conventions and rules that apply generally to all of the elements and +attributes in the manifest file.

@@ -172,29 +186,28 @@ in the manifest:
Only the <manifest> and <application> -elements are required, they each must be present and can occur only once. -Most of the others can occur many times or not at all — although at -least some of them must be present for the manifest to accomplish anything -meaningful. +elements are required. They each must be present and can occur only once. +Most of the other elements can occur many times or not at all. However, at +least some of them must be present before the manifest file becomes useful.

If an element contains anything at all, it contains other elements. -All values are set through attributes, not as character data within an element. +All of the values are set through attributes, not as character data within an element.

-Elements at the same level are generally not ordered. For example, +Elements at the same level are generally not ordered. For example, the <activity>, <provider>, and <service> elements can be intermixed in any sequence. There are two key exceptions to this -rule, however: +rule:

Attributes
-
In a formal sense, all attributes are optional. However, there are some -that must be specified for an element to accomplish its purpose. Use the -documentation as a guide. For truly optional attributes, it mentions a default +
In a formal sense, all attributes are optional. However, there are some attributes +that must be specified so that an element can accomplish its purpose. Use the +documentation as a guide. For truly optional attributes, it mentions a default value or states what happens in the absence of a specification.

Except for some attributes of the root <manifest> -element, all attribute names begin with an {@code android:} prefix — -for example, {@code android:alwaysRetainTaskState}. Because the prefix is +element, all attribute names begin with an {@code android:} prefix. +For example, {@code android:alwaysRetainTaskState}. Because the prefix is universal, the documentation generally omits it when referring to attributes by name.

@@ -223,7 +236,7 @@ by name.

Many elements correspond to Java objects, including elements for the application itself (the <application> -element) and its principal components — activities +element) and its principal components: activities (<activity>), services (<service>), @@ -238,7 +251,7 @@ If you define a subclass, as you almost always would for the component classes {@link android.content.BroadcastReceiver}, and {@link android.content.ContentProvider}), the subclass is declared through a {@code name} attribute. The name must include the full package designation. -For example, an {@link android.app.Service} subclass might be declared as follows: +For example, a {@link android.app.Service} subclass might be declared as follows:

<manifest . . . >
@@ -251,12 +264,12 @@ For example, an {@link android.app.Service} subclass might be declared as follow
 </manifest>

-However, as a shorthand, if the first character of the string is a period, the -string is appended to the application's package name (as specified by the +However, if the first character of the string is a period, the +application's package name (as specified by the <manifest> element's package -attribute). The following assignment is the same as the one above: +attribute) is appended to the string. The following assignment is the same as that shown above:

<manifest package="com.example.project" . . . >
@@ -269,13 +282,13 @@ attribute).  The following assignment is the same as the one above:
 </manifest>

-When starting a component, Android creates an instance of the named subclass. +When starting a component, the Android system creates an instance of the named subclass. If a subclass isn't specified, it creates an instance of the base class.

Multiple values
If more than one value can be specified, the element is almost always -repeated, rather than listing multiple values within a single element. +repeated, rather than multiple values being listed within a single element. For example, an intent filter can list several actions:
<intent-filter . . . >
@@ -286,108 +299,105 @@ For example, an intent filter can list several actions:
 </intent-filter>
Resource values
-
Some attributes have values that can be displayed to users — for -example, a label and an icon for an activity. The values of these attributes -should be localized and therefore set from a resource or theme. Resource -values are expressed in the following format,

+
Some attributes have values that can be displayed to users, such as +a label and an icon for an activity. The values of these attributes +should be localized and set from a resource or theme. Resource +values are expressed in the following format:

{@code @[package:]type/name}

-where the package name can be omitted if the resource is in the same package -as the application, type is a type of resource — such as "string" or -"drawable" — and name is the name that identifies the specific resource. -For example: +You can ommit the package name if the resource is in the same package +as the application. The type is a type of resource, such as string or +drawable, and the name is the name that identifies the specific resource. +Here is an example:

<activity android:icon="@drawable/smallPic" . . . >

-Values from a theme are expressed in a similar manner, but with an initial '{@code ?}' -rather than '{@code @}': +The values from a theme are expressed similarly, but with an initial {@code ?} +instead of {@code @}:

{@code ?[package:]type/name}

String values
-
Where an attribute value is a string, double backslashes ('{@code \\}') -must be used to escape characters — for example, '{@code \\n}' for -a newline or '{@code \\uxxxx}' for a Unicode character.
+
Where an attribute value is a string, you must use double backslashes ({@code \\}) +to escape characters, such as {@code \\n} for +a newline or {@code \\uxxxx} for a Unicode character.
- -

File Features

+

File features

-The following sections describe how some Android features are reflected +The following sections describe the way that some Android features are reflected in the manifest file.

-

Intent Filters

+

Intent filters

-The core components of an application (its activities, services, and broadcast -receivers) are activated by intents. An intent is a +The core components of an application, such as its activities, services, and broadcast +receivers, are activated by intents. An intent is a bundle of information (an {@link android.content.Intent} object) describing a -desired action — including the data to be acted upon, the category of +desired action, including the data to be acted upon, the category of component that should perform the action, and other pertinent instructions. -Android locates an appropriate component to respond to the intent, launches +The Android system locates an appropriate component that can respond to the intent, launches a new instance of the component if one is needed, and passes it the -Intent object. +{@link android.content.Intent} object.

-Components advertise their capabilities — the kinds of intents they can -respond to — through intent filters. Since the Android system -must learn which intents a component can handle before it launches the component, +The components advertise the types of intents that they can +respond to through intent filters. Since the Android system +must learn the intents that a component can handle before it launches the component, intent filters are specified in the manifest as <intent-filter> -elements. A component may have any number of filters, each one describing +elements. A component can have any number of filters, each one describing a different capability.

-An intent that explicitly names a target component will activate that component; -the filter doesn't play a role. But an intent that doesn't specify a target by +An intent that explicitly names a target component activates that component, so +the filter doesn't play a role. An intent that doesn't specify a target by name can activate a component only if it can pass through one of the component's filters.

-For information on how Intent objects are tested against intent filters, -see a separate document, -Intents -and Intent Filters. +For information about how {@link android.content.Intent} objects are tested against intent filters, +see the Intents +and Intent Filters document.

- -

Icons and Labels

+

Icons and labels

A number of elements have {@code icon} and {@code label} attributes for a -small icon and a text label that can be displayed to users. Some also have a -{@code description} attribute for longer explanatory text that can also be -shown on-screen. For example, the +small icon and a text label that can be displayed to users. Some also have a +{@code description} attribute for longer, explanatory text that can also be +shown on-screen. For example, the <permission> -element has all three of these attributes, so that when the user is asked whether +element has all three of these attributes so that when the user is asked whether to grant the permission to an application that has requested it, an icon representing the permission, the name of the permission, and a description of what it -entails can all be presented to the user. +entails are all presented to the user.

-In every case, the icon and label set in a containing element become the default +In every case, the icon and label that are set in a containing element become the default {@code icon} and {@code label} settings for all of the container's subelements. -Thus, the icon and label set in the +Thus, the icon and label that are set in the <application> element are the default icon and label for each of the application's components. -Similarly, the icon and label set for a component — for example, an +Similarly, the icon and label that are set for a component, such as an <activity> -element — are the default settings for each of the component's +element, are the default settings for each of the component's <intent-filter> -elements. If an +elements. If an <application> element sets a label, but an activity and its intent filter do not, the application label is treated as the label for both the activity and @@ -395,62 +405,62 @@ the intent filter.

-The icon and label set for an intent filter are used to represent a component -whenever the component is presented to the user as fulfilling the function -advertised by the filter. For example, a filter with -"{@code android.intent.action.MAIN}" and -"{@code android.intent.category.LAUNCHER}" settings advertises an activity -as one that initiates an application — that is, as -one that should be displayed in the application launcher. The icon and label -set in the filter are therefore the ones displayed in the launcher. +The icon and label that are set for an intent filter represent a component +whenever the component is presented to the user and fulfills the function +that is advertised by the filter. For example, a filter with +{@code android.intent.action.MAIN} and +{@code android.intent.category.LAUNCHER} settings advertises an activity +as one that initiates an application. That is, as +one that should be displayed in the application launcher. The icon and label +that are set in the filter are displayed in the launcher.

-

Permissions

-A permission is a restriction limiting access to a part of the code -or to data on the device. The limitation is imposed to protect critical +A permission is a restriction that limits access to a part of the code +or to data on the device. The limitation is imposed to protect critical data and code that could be misused to distort or damage the user experience.

-Each permission is identified by a unique label. Often the label indicates -the action that's restricted. For example, here are some permissions defined +Each permission is identified by a unique label. Often the label indicates +the action that's restricted. Here are some permissions that are defined by Android:

-

{@code android.permission.CALL_EMERGENCY_NUMBERS} -
{@code android.permission.READ_OWNER_DATA} -
{@code android.permission.SET_WALLPAPER} -
{@code android.permission.DEVICE_POWER}

+

-A feature can be protected by at most one permission. +A feature can be protected by only one permission.

-If an application needs access to a feature protected by a permission, -it must declare that it requires that permission with a +If an application needs access to a feature that is protected by a permission, +it must declare that it requires the permission with a <uses-permission> -element in the manifest. Then, when the application is installed on -the device, the installer determines whether or not to grant the requested +element in the manifest. When the application is installed on +the device, the installer determines whether to grant the requested permission by checking the authorities that signed the application's certificates and, in some cases, asking the user. If the permission is granted, the application is able to use the protected -features. If not, its attempts to access those features will simply fail +features. If not, its attempts to access those features fail without any notification to the user.

-An application can also protect its own components (activities, services, -broadcast receivers, and content providers) with permissions. It can employ -any of the permissions defined by Android (listed in -{@link android.Manifest.permission android.Manifest.permission}) or declared -by other applications. Or it can define its own. A new permission is declared +An application can also protect its own components with permissions. It can employ +any of the permissions that are defined by Android, as listed in +{@link android.Manifest.permission android.Manifest.permission}, or declared +by other applications. It can also define its own. A new permission is declared with the <permission> -element. For example, an activity could be protected as follows: +element. For example, an activity could be protected as follows:

@@ -474,34 +484,34 @@ declared with the
 <permission>
 element, its use is also requested with the
 <uses-permission>
-element.  Its use must be requested in order for other components of the
+element. You must request its use in order for other components of the
 application to launch the protected activity, even though the protection
 is imposed by the application itself.
 

-If, in the same example, the {@code permission} attribute was set to a -permission declared elsewhere -(such as {@code android.permission.CALL_EMERGENCY_NUMBERS}, it would not -have been necessary to declare it again with a +If, in the same example shown above, the {@code permission} attribute was set to a +permission that is declared elsewhere, +such as {@code android.permission.CALL_EMERGENCY_NUMBERS}, it would not +be necessary to declare it again with a <permission> -element. However, it would still have been necessary to request its use with +element. However, it would still be necessary to request its use with <uses-permission>.

The <permission-tree> -element declares a namespace for a group of permissions that will be defined in -code. And +element declares a namespace for a group of permissions that are defined in +code, and the <permission-group> -defines a label for a set of permissions (both those declared in the manifest with +defines a label for a set of permissions, both those declared in the manifest with <permission> -elements and those declared elsewhere). It affects only how the permissions are -grouped when presented to the user. The +elements and those declared elsewhere. This affects only how the permissions are +grouped when presented to the user. The <permission-group> -element does not specify which permissions belong to the group; -it just gives the group a name. A permission is placed in the group +element does not specify the permissions that belong to the group, but +it gives the group a name. You can place a permission in the group by assigning the group name to the <permission> element's @@ -515,15 +525,14 @@ attribute.

Every application is linked against the default Android library, which includes the basic packages for building applications (with common classes -such as Activity, Service, Intent, View, Button, Application, ContentProvider, -and so on). +such as Activity, Service, Intent, View, Button, Application, and ContentProvider).

-However, some packages reside in their own libraries. If your application -uses code from any of these packages, it must explicitly asked to be linked -against them. The manifest must contain a separate +However, some packages reside in their own libraries. If your application +uses code from any of these packages, it must explicitly ask to be linked +against them. The manifest must contain a separate <uses-library> -element to name each of the libraries. (The library name can be found in the -documentation for the package.) +element to name each of the libraries. You can find the library name in the +documentation for the package.

diff --git a/docs/html/topic/arc/manifest.jd b/docs/html/topic/arc/manifest.jd new file mode 100644 index 0000000000000..7d1866591ab3f --- /dev/null +++ b/docs/html/topic/arc/manifest.jd @@ -0,0 +1,341 @@ +page.title=App Manifest Compatibility for Chromebooks +@jd:body + +
+ +
+ +

+As you prepare your Android app to run on Chromebooks, you should consider the +device features that your app uses. Chromebooks don't support all of the +hardware and software features that are available on other devices running +Android. If your app requires specific features that aren't supported on +Chromebooks, it won't be available for installation on Chromebooks. +

+ +

+You declare your app's requirements for hardware features and certain software +features in the manifest file. +This document describes the app manifest feature declarations that aren't +compatible with Chromebooks. +

+ +

Incompatible Manifest Entries

+ +

+The manifest entries listed in this section aren't currently compatible with +Chromebooks. If your app uses any of these entries, consider removing them or +including the required="false" attribute value with them so that +your app can be installed on Chromebooks. For more information about declaring +feature use without requiring that the feature be available on the device, see +the guide for the +<uses-feature> manifest element. +

+ +

Note: See the +Features Reference for a complete list of app manifest features and +descriptions. +

+ +

Hardware features

+ +

+Support for hardware features varies on Chromebooks. Some features aren't +supported on any Chromebooks while others are supported on some Chromebooks. +

+ +

Unsupported hardware features

+ +

+The following list includes the hardware features that aren't currently +supported on Chromebooks: +

+ + + +

Partially-supported hardware features

+ +

+The following list includes the hardware features that may be available on some +Chromebooks: +

+ + + +

Touchscreen hardware support

+ +

+As of Chrome OS version M53, all Android apps that don't explicitly require the + +android.hardware.touchscreen feature will also work on Chrome +OS devices that support the +android.hardware.faketouch feature. Devices that have fake +touch interfaces provide a user input system that emulates basic touch events. +For example, the user could interact with a mouse or remote control to move an +on-screen cursor, scroll through a list, and drag elements from one part of the +screen to another. +

+ +

+If you don't want your app to be installed on devices that have fake touch +interfaces but not touchscreens, you can complete one of the following actions: +

+ + + +

Software features

+ +

+The following list includes the software features that aren't currently +supported on Chromebooks: +

+ + + +

Permissions That Imply Feature Requirements

+ +

+Some permissions that you request in your manifest files can create implied +requests for hardware and software features. By requesting these permissions, +you'll prevent your app from being installed on Chromebooks. +

+ +

+For details about how to prevent permission requests from making your app +unavailable on Chromebooks, see the Incompatible +Manifest Entries section of this page. +

+ +

+The following table shows the permissions that imply certain feature +requirements which make an app incompatible with Chromebooks: +

+ +

+Table 1. Device permissions that imply hardware features which +are incompatible with Chromebooks. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryThis Permission......Implies This Feature Requirement
CameraCAMERA + android.hardware.camera and
+ android.hardware.camera.autofocus +
TelephonyCALL_PHONEandroid.hardware.telephony
CALL_PRIVILEGEDandroid.hardware.telephony
MODIFY_PHONE_STATEandroid.hardware.telephony
PROCESS_OUTGOING_CALLSandroid.hardware.telephony
READ_SMSREAD_SMSandroid.hardware.telephony
RECEIVE_SMSandroid.hardware.telephony
RECEIVE_MMSandroid.hardware.telephony
RECEIVE_WAP_PUSHandroid.hardware.telephony
SEND_SMSandroid.hardware.telephony
WRITE_APN_SETTINGSandroid.hardware.telephony
WRITE_SMSandroid.hardware.telephony