1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.support.v4.content;
18
19import android.content.Context;
20
21/**
22 * Helper for accessing features in {@link android.content.Intent}
23 * introduced after API level 4 in a backwards compatible fashion.
24 */
25public class IntentCompat {
26
27    private IntentCompat() {
28        /* Hide constructor */
29    }
30
31    /**
32     * Broadcast Action: Resources for a set of packages (which were
33     * previously unavailable) are currently
34     * available since the media on which they exist is available.
35     * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a
36     * list of packages whose availability changed.
37     * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a
38     * list of uids of packages whose availability changed.
39     * Note that the
40     * packages in this list do <em>not</em> receive this broadcast.
41     * The specified set of packages are now available on the system.
42     * <p>Includes the following extras:
43     * <ul>
44     * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages
45     * whose resources(were previously unavailable) are currently available.
46     * {@link #EXTRA_CHANGED_UID_LIST} is the set of uids of the
47     * packages whose resources(were previously unavailable)
48     * are  currently available.
49     * </ul>
50     *
51     * <p class="note">This is a protected intent that can only be sent
52     * by the system.
53     */
54    public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE =
55        "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
56
57    /**
58     * Broadcast Action: Resources for a set of packages are currently
59     * unavailable since the media on which they exist is unavailable.
60     * The extra data {@link #EXTRA_CHANGED_PACKAGE_LIST} contains a
61     * list of packages whose availability changed.
62     * The extra data {@link #EXTRA_CHANGED_UID_LIST} contains a
63     * list of uids of packages whose availability changed.
64     * The specified set of packages can no longer be
65     * launched and are practically unavailable on the system.
66     * <p>Inclues the following extras:
67     * <ul>
68     * <li> {@link #EXTRA_CHANGED_PACKAGE_LIST} is the set of packages
69     * whose resources are no longer available.
70     * {@link #EXTRA_CHANGED_UID_LIST} is the set of packages
71     * whose resources are no longer available.
72     * </ul>
73     *
74     * <p class="note">This is a protected intent that can only be sent
75     * by the system.
76     */
77    public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE =
78        "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
79
80    /**
81     * This field is part of
82     * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE},
83     * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}
84     * and contains a string array of all of the components that have changed.
85     */
86    public static final String EXTRA_CHANGED_PACKAGE_LIST =
87            "android.intent.extra.changed_package_list";
88
89    /**
90     * This field is part of
91     * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE},
92     * {@link android.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}
93     * and contains an integer array of uids of all of the components
94     * that have changed.
95     */
96    public static final String EXTRA_CHANGED_UID_LIST =
97            "android.intent.extra.changed_uid_list";
98
99    /**
100     * If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
101     * this flag will cause a newly launching task to be placed on top of the current
102     * home activity task (if there is one). That is, pressing back from the task
103     * will always return the user to home even if that was not the last activity they
104     * saw. This can only be used in conjunction with
105     * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}.
106     */
107    public static final int FLAG_ACTIVITY_TASK_ON_HOME = 0x00004000;
108
109    /**
110     * If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
111     * this flag will cause any existing task that would be associated with the
112     * activity to be cleared before the activity is started.  That is, the activity
113     * becomes the new root of an otherwise empty task, and any old activities
114     * are finished.  This can only be used in conjunction with
115     * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}.
116     *
117     * <p>This flag will only be obeyed on devices supporting API 11 or higher.</p>
118     */
119    public static final int FLAG_ACTIVITY_CLEAR_TASK = 0x00008000;
120}
121