Skip to content

Commit c351ab4

Browse files
committed
cherrypick from hc-mr2 Change-Id: Ia38b7c364a3a655faa5cc5d13e19c2dbbb12eee5
docs: add docs for new hardware feature constants Change-Id: I1b5b7b37a85856d28db8ecf08b070f24312ccca2
1 parent 99f3668 commit c351ab4

File tree

3 files changed

+118
-27
lines changed

3 files changed

+118
-27
lines changed

docs/html/guide/topics/manifest/activity-element.jd

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,9 @@ resource usage.
581581
</p></dd>
582582

583583
<dt><a name="screen"></a>{@code android:screenOrientation}</dt>
584-
<dd>The orientation of the activity's display on the device.
585-
The value can be any one of the following strings:
584+
<dd>The orientation of the activity's display on the device.
585+
586+
<p>The value can be any one of the following strings:</p>
586587

587588
<table>
588589
<tr>
@@ -640,7 +641,23 @@ is ignored, so the display will not rotate based on how the user moves the devic
640641
distinction, the system chooses the orientation using the same policy as for the "{@code
641642
unspecified}" setting.</td>
642643
</tr>
643-
</table></dd>
644+
</table>
645+
646+
<p class="note"><strong>Note:</strong> When you declare one of the landscape or portrait values,
647+
it is considered a hard requirement for the orientation in which the activity runs. As such,
648+
the value you declare enables filtering by services such as Android Market so your application is
649+
available only to devices that support the orientation required by your activities. For
650+
example, if you declare either {@code "landscape"}, {@code "reverseLandscape"}, or
651+
{@code "sensorLandscape"}, then your application will be available only to devices that support
652+
landscape orientation. However, you should also explicitly declare that
653+
your application requires either portrait or landscape orientation with the <a
654+
href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
655+
element. For example, <code>&lt;uses-feature
656+
android:name="android.hardware.screen.portrait"/></code>. This is purely a filtering behavior
657+
provided by Android Market (and other services that support it) and the platform itself does not
658+
control whether your app can be installed when a device supports only certain orientations.</p>
659+
660+
</dd>
644661

645662
<dt><a name="state"></a>{@code android:stateNotNeeded}</dt>
646663
<dd>Whether or not the activity can be killed and successfully restarted

docs/html/guide/topics/manifest/uses-feature-element.jd

Lines changed: 93 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ the device before installing an application. However, other services
111111
with your application. For this reason, it's very important that you declare all of
112112
the features (from the list below) that your application uses. </p>
113113

114-
<p>For some features, there may exist a specfic attribute that allows you to define
114+
<p>For some features, there may exist a specific attribute that allows you to define
115115
a version of the feature, such as the version of Open GL used (declared with
116116
<a href="#glEsVersion"><code>glEsVersion</code></a>). Other features that either do or do not
117117
exist for a device, such as a camera, are declared using the
@@ -277,7 +277,7 @@ application absolutely requires the feature and cannot function properly without
277277
it (<code>"true"</code>), or whether the application prefers to use the feature
278278
if available, but is designed to run without it (<code>"false"</code>).</p>
279279

280-
<p>Android Market handles explictly declared features in this way: </p>
280+
<p>Android Market handles explicitly declared features in this way: </p>
281281

282282
<ul>
283283
<li>If a feature is explicitly declared as being required, Android Market adds
@@ -287,7 +287,7 @@ For example:
287287
<pre>&lt;uses-feature android:name="android.hardware.camera" android:required="true" /&gt;</pre></li>
288288
<li>If a feature is explicitly declared as <em>not</em> being required, Android
289289
Market <em>does not</em> add the feature to the list of required features. For
290-
that reason, an explicity declared non-required feature is never considered when
290+
that reason, an explicitly declared non-required feature is never considered when
291291
filtering the application. Even if the device does not provide the declared
292292
feature, Android Market will still consider the application compatible with the
293293
device and will show it to the user, unless other filtering rules apply. For
@@ -650,6 +650,40 @@ the device.</td>
650650
<td>The application uses the device's proximity sensor.</td>
651651
<td></td>
652652
</tr>
653+
654+
<tr>
655+
<td rowspan="2">Screen</td>
656+
<td><code>android.hardware.screen.landscape</code></td>
657+
<td>The application requires landscape orientation.</td>
658+
<td rowspan="2">
659+
<p>For example, if your app requires portrait orientation, you should declare
660+
<code>&lt;uses-feature android:name="android.hardware.screen.portrait"/></code> so that only devices
661+
that support portrait orientation (whether always or by user choice) can install your app. If your
662+
application <em>supports</em> both orientations, then you don't need to declare either.</p>
663+
<p>Both orientations are assumed <em>not required</em>, by default, so your app may be installed
664+
on devices that support one or both orientations. However, if any of your activities request that
665+
they run in a specific orientation, using the <a
666+
href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
667+
android:screenOrientation}</a> attribute, then this also declares that the application requires that
668+
orientation. For example, if you declare <a
669+
href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
670+
android:screenOrientation}</a> with either {@code "landscape"}, {@code "reverseLandscape"}, or
671+
{@code "sensorLandscape"}, then your application will be available only to devices that support
672+
landscape orientation. As a best practice, you should still declare your requirement for this
673+
orientation using a {@code &lt;uses-feature&gt;} element. If you declare an orientation for your
674+
activity using <a href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
675+
android:screenOrientation}</a>, but don't actually <em>require</em> it, you can disable the
676+
requirement by declaring the orientation with a {@code &lt;uses-feature&gt;} element and include
677+
{@code android:required="false"}.</p>
678+
<p>For backwards compatibility, any device running a platform version that supports only API
679+
level 12 or lower is assumed to support both landscape and portrait.</p>
680+
</td>
681+
</tr>
682+
<tr>
683+
<td><code>android.hardware.screen.portrait</code></td>
684+
<td>The application requires portrait orientation.</td>
685+
</tr>
686+
653687
<tr>
654688
<td rowspan="3">Telephony</td>
655689
<td><code>android.hardware.telephony</code></td>
@@ -672,36 +706,72 @@ device.</td>
672706
</tr>
673707

674708
<tr>
675-
<td rowspan="5">Touchscreen</td>
709+
<td rowspan="7">Touchscreen</td>
676710
<td><code>android.hardware.faketouch</code></td>
677711
<td>The application uses basic touch interaction events, such as "click down", "click
678712
up", and drag.</td>
679-
<td>When declared, this indicates that the application is compatible with a device that offers an
680-
emulated touchscreen ("fake touch" interface), or better. A device that offers a fake touch
681-
interface provides a user input system that emulates a subset of touchscreen capabilities. For
682-
example, a mouse or remote control that drives an on-screen cursor provides a fake touch interface.
683-
If your application requires only basic point and click interaction, you should declare this
684-
feature. Because this is the minimum level of touch interaction, your app will also be compatible
685-
with devices that offer more complex touch interfaces.
713+
<td><p>When declared as required, this indicates that the application is compatible with a device
714+
only if it offers an emulated touchscreen ("fake touch" interface), or better. A device that offers
715+
a fake touch interface provides a user input system that emulates a subset of touchscreen
716+
capabilities. For example, a mouse or remote control that drives an on-screen cursor provides a fake
717+
touch interface. If your application requires basic point and click interaction (in other
718+
words, it won't work with <em>only</em> a d-pad controller), you should declare this feature.
719+
Because this is the minimum level of touch interaction, your app will also be compatible with
720+
devices that offer more complex touch interfaces.</p>
686721
<p class="note"><strong>Note:</strong> Because applications require the {@code
687722
android.hardware.touchscreen} feature by default, if you want your application to be available to
688723
devices that provide a fake touch interface, you must also explicitly declare that a touch screen is
689724
<em>not</em> required by declaring {@code &lt;uses-feature
690725
android:name="android.hardware.touchscreen" <strong>android:required="false"</strong>
691726
/&gt;}</p></td>
692727
</tr>
728+
729+
<tr>
730+
<td><code>android.hardware.faketouch.multitouch.distinct</code></td>
731+
<td>The application performs distinct tracking of two or more "fingers" on a fake touch
732+
interface. This is a superset of the faketouch feature.</td>
733+
<td><p>When declared as required, this indicates that the application is compatible with a device
734+
only if it supports touch emulation for events that supports distinct tracking of two or more
735+
fingers, or better.</p>
736+
<p>Unlike the distinct multitouch defined by {@code
737+
android.hardware.touchscreen.multitouch.distinct}, input devices that support distinct multi-touch
738+
with a fake touch interface will not support all two-finger gestures, because the input is
739+
being transformed to cursor movement on the screen. That is, single finger gestures on such a device
740+
move a cursor; two-finger swipes will result in single-finger touch events; other two-finger
741+
gestures will result in the corresponding two-finger touch event. An example device that supports
742+
distinct multi-touch with a fake touch interface is one that provides a trackpad for cursor movement
743+
which also supports two or more fingers.</p></td>
744+
</tr>
745+
746+
<tr>
747+
<td><code>android.hardware.faketouch.multitouch.jazzhand</code></td>
748+
<td>The application performs distinct tracking of five or more "fingers" on a fake touch
749+
interface. This is a superset of the faketouch feature.</td>
750+
<td><p>When declared as required, this indicates that the application is compatible with a device
751+
only if it supports touch emulation for events that supports distinct tracking of five or more
752+
fingers.</p>
753+
<p>Unlike the distinct multitouch defined by {@code
754+
android.hardware.touchscreen.multitouch.jazzhand}, input devices that support jazzhand multi-touch
755+
with a fake touch interface will not support all five-finger gestures, because the input is being
756+
transformed to cursor movement on the screen. That is, single finger gestures on such a device move
757+
a cursor; multi-finger gestures will result in single-finger touch events; other multi-finger
758+
gestures will result in the corresponding multi-finger touch event. An example device that supports
759+
distinct multi-touch with a fake touch interface is one that provides a trackpad for cursor movement
760+
which also supports five or more fingers.</p></td>
761+
</tr>
762+
693763
<tr>
694764
<td><code>android.hardware.touchscreen</code></td>
695765
<td>The application uses touchscreen capabilities for gestures that are more interactive
696-
than basic touch events, such as a fling. This is a superset of the faketouch features.</td>
697-
<td>By default, your application requires this. As such, your application is
698-
<em>not</em> available to devices that provide only an emulated touch interface ("fake touch"), by
699-
default. If you want your application available to devices that provide a fake touch interface,
700-
you must explicitly declare that a touch screen is not required, by
701-
declaring {@code android.hardware.touchscreen} with {@code android:required="false"}. You should
702-
do so even if your application uses&mdash;but does not <em>require</em>&mdash;a real touch screen
703-
interface.
704-
<p>If your application <em>does require</em> a basic touch interface (in order to perform touch
766+
than basic touch events, such as a fling. This is a superset of the basic faketouch feature.</td>
767+
<td><p>By default, your application requires this. As such, your application is <em>not</em>
768+
available to devices that provide only an emulated touch interface ("fake touch"), by default. If
769+
you want your application available to devices that provide a fake touch interface (or even devices
770+
that provide only a d-pad controller), you must explicitly declare that a touch screen is not
771+
required, by declaring {@code android.hardware.touchscreen} with {@code android:required="false"}.
772+
You should do so even if your application uses&mdash;but does not <em>require</em>&mdash;a real
773+
touch screen interface.</p>
774+
<p>If your application <em>does require</em> a touch interface (in order to perform touch
705775
gestures such as a fling), then you don't need to do anything, because this is required by default.
706776
However, it's best if you explicitly declare all features used by your application, so you should
707777
still declare this if your app uses it.</p>
@@ -712,23 +782,23 @@ should declare the advanced touch screen features below.</p></td>
712782
<td><code>android.hardware.touchscreen.multitouch</code></td>
713783
<td>The application uses basic two-point multitouch capabilities on the device
714784
screen, such as for pinch gestures, but does not need to track touches independently. This
715-
is a superset of touchscreen features.</td>
785+
is a superset of touchscreen feature.</td>
716786
<td>This implicitly declares the <code>android.hardware.touchscreen</code> parent feature, unless
717787
declared with <code>android:required="false"</code>. </td>
718788
</tr>
719789
<tr>
720790
<td><code>android.hardware.touchscreen.multitouch.distinct</code></td>
721791
<td>Subfeature. The application uses advanced multipoint multitouch
722792
capabilities on the device screen, such as for tracking two or more points fully
723-
independently. This is a superset of multitouch features.</td>
793+
independently. This is a superset of multitouch feature.</td>
724794
<td rowspan="2">This implicitly declares the <code>android.hardware.touchscreen.multitouch</code>
725795
parent feature, unless declared with <code>android:required="false"</code>. </td>
726796
</tr>
727797
<tr>
728798
<td><code>android.hardware.touchscreen.multitouch.jazzhand</code></td>
729799
<td>The application uses advanced multipoint multitouch
730800
capabilities on the device screen, for tracking up to five points fully
731-
independently. This is a superset of distinct multitouch features.</td>
801+
independently. This is a superset of distinct multitouch feature.</td>
732802
</tr>
733803

734804
<tr>

docs/html/sdk/android-3.2.jd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,11 @@ portrait orientation.</li>
550550

551551
<p>A typical application that functions properly in both landscape and portrait orientations would not normally need to declare an orientation requirement. Rather, an application designed primarily for one orientation, such as an app designed for a television, could declare one of the constants to ensure that it isn't available to devices that don't provide that orientation.</p>
552552

553-
<p>If the application is targeting API level 12 or lower, the platform assumes that if app has not specified whether it requires portrait or landscape, both orientations are required.</p>
553+
<p>If any of activities declared in the manifest request that they run in a specific orientation,
554+
using the <a href="{@docRoot}guide/topics/manifest/activity-element.html#screen">{@code
555+
android:screenOrientation}</a> attribute, then this also declares that the application
556+
requires that orientation.</p>
557+
554558
</li>
555559
<li>Other feature constants
556560

0 commit comments

Comments
 (0)