blob: 32cd2d5e24b477f3f3387078d4ee20a6cc20984f [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
2 * Copyright (C) 2007 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package android.content.pm;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21import android.util.Printer;
22
23import java.text.Collator;
24import java.util.Comparator;
25
26/**
27 * Information you can retrieve about a particular application. This
28 * corresponds to information collected from the AndroidManifest.xml's
29 * <application> tag.
30 */
31public class ApplicationInfo extends PackageItemInfo implements Parcelable {
32
33 /**
34 * Default task affinity of all activities in this application. See
35 * {@link ActivityInfo#taskAffinity} for more information. This comes
36 * from the "taskAffinity" attribute.
37 */
38 public String taskAffinity;
39
40 /**
41 * Optional name of a permission required to be able to access this
42 * application's components. From the "permission" attribute.
43 */
44 public String permission;
45
46 /**
47 * The name of the process this application should run in. From the
48 * "process" attribute or, if not set, the same as
49 * <var>packageName</var>.
50 */
51 public String processName;
52
53 /**
54 * Class implementing the Application object. From the "class"
55 * attribute.
56 */
57 public String className;
58
59 /**
60 * A style resource identifier (in the package's resources) of the
61 * description of an application. From the "description" attribute
62 * or, if not set, 0.
63 */
64 public int descriptionRes;
65
66 /**
67 * A style resource identifier (in the package's resources) of the
68 * default visual theme of the application. From the "theme" attribute
69 * or, if not set, 0.
70 */
71 public int theme;
72
73 /**
74 * Class implementing the Application's manage space
75 * functionality. From the "manageSpaceActivity"
76 * attribute. This is an optional attribute and will be null if
Christopher Tate181fafa2009-05-14 11:12:14 -070077 * applications don't specify it in their manifest
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 */
79 public String manageSpaceActivityName;
80
81 /**
Christopher Tate181fafa2009-05-14 11:12:14 -070082 * Class implementing the Application's backup functionality. From
83 * the "backupAgent" attribute. This is an optional attribute and
84 * will be null if the application does not specify it in its manifest.
85 *
86 * <p>If android:allowBackup is set to false, this attribute is ignored.
Christopher Tate181fafa2009-05-14 11:12:14 -070087 */
88 public String backupAgentName;
89
90 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 * Value for {@link #flags}: if set, this application is installed in the
92 * device's system image.
93 */
94 public static final int FLAG_SYSTEM = 1<<0;
95
96 /**
97 * Value for {@link #flags}: set to true if this application would like to
98 * allow debugging of its
99 * code, even when installed on a non-development system. Comes
100 * from {@link android.R.styleable#AndroidManifestApplication_debuggable
101 * android:debuggable} of the &lt;application&gt; tag.
102 */
103 public static final int FLAG_DEBUGGABLE = 1<<1;
104
105 /**
106 * Value for {@link #flags}: set to true if this application has code
107 * associated with it. Comes
108 * from {@link android.R.styleable#AndroidManifestApplication_hasCode
109 * android:hasCode} of the &lt;application&gt; tag.
110 */
111 public static final int FLAG_HAS_CODE = 1<<2;
112
113 /**
114 * Value for {@link #flags}: set to true if this application is persistent.
115 * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent
116 * android:persistent} of the &lt;application&gt; tag.
117 */
118 public static final int FLAG_PERSISTENT = 1<<3;
119
120 /**
Christopher Tate181fafa2009-05-14 11:12:14 -0700121 * Value for {@link #flags}: set to true if this application holds the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 * {@link android.Manifest.permission#FACTORY_TEST} permission and the
123 * device is running in factory test mode.
124 */
125 public static final int FLAG_FACTORY_TEST = 1<<4;
126
127 /**
128 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
129 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting
130 * android:allowTaskReparenting} of the &lt;application&gt; tag.
131 */
132 public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5;
133
134 /**
135 * Value for {@link #flags}: default value for the corresponding ActivityInfo flag.
136 * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData
137 * android:allowClearUserData} of the &lt;application&gt; tag.
138 */
139 public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6;
140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700142 * Value for {@link #flags}: this is set if this application has been
143 * install as an update to a built-in system application.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 */
145 public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700146
147 /**
Dianne Hackborn7f205432009-07-28 00:13:47 -0700148 * Value for {@link #flags}: this is set of the application has specified
149 * {@link android.R.styleable#AndroidManifestApplication_testOnly
150 * android:testOnly} to be true.
Dianne Hackborn851a5412009-05-08 12:06:44 -0700151 */
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700152 public static final int FLAG_TEST_ONLY = 1<<8;
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700153
154 /**
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700155 * Value for {@link #flags}: true when the application's window can be
Dianne Hackborn723738c2009-06-25 19:48:04 -0700156 * reduced in size for smaller screens. Corresponds to
157 * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens
158 * android:smallScreens}.
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700159 */
Dianne Hackborn723738c2009-06-25 19:48:04 -0700160 public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9;
161
162 /**
163 * Value for {@link #flags}: true when the application's window can be
164 * displayed on normal screens. Corresponds to
165 * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens
166 * android:normalScreens}.
167 */
168 public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10;
169
170 /**
171 * Value for {@link #flags}: true when the application's window can be
172 * increased in size for larger screens. Corresponds to
173 * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens
174 * android:smallScreens}.
175 */
176 public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11;
Dianne Hackborn5c1e00b2009-06-18 17:10:57 -0700177
178 /**
Dianne Hackbornc4db95c2009-07-21 17:46:02 -0700179 * Value for {@link #flags}: true when the application knows how to adjust
180 * its UI for different screen sizes. Corresponds to
181 * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable
182 * android:resizeable}.
183 */
184 public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12;
185
186 /**
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700187 * Value for {@link #flags}: true when the application knows how to
188 * accomodate different screen densities. Corresponds to
189 * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity
190 * android:anyDensity}.
191 */
192 public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13;
193
194 /**
Ben Cheng23085b72010-02-08 16:06:32 -0800195 * Value for {@link #flags}: set to true if this application would like to
196 * request the VM to operate under the safe mode. Comes from
197 * {@link android.R.styleable#AndroidManifestApplication_safeMode
198 * android:safeMode} of the &lt;application&gt; tag.
199 */
200 public static final int FLAG_VM_SAFE_MODE = 1<<14;
201
202 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800203 * Value for {@link #flags}: set to <code>false</code> if the application does not wish
204 * to permit any OS-driven backups of its data; <code>true</code> otherwise.
Christopher Tate181fafa2009-05-14 11:12:14 -0700205 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800206 * <p>Comes from the
207 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
208 * attribute of the &lt;application&gt; tag.
Christopher Tate181fafa2009-05-14 11:12:14 -0700209 */
Ben Cheng23085b72010-02-08 16:06:32 -0800210 public static final int FLAG_ALLOW_BACKUP = 1<<15;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700211
212 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800213 * Value for {@link #flags}: set to <code>false</code> if the application must be kept
214 * in memory following a full-system restore operation; <code>true</code> otherwise.
215 * Ordinarily, during a full system restore operation each application is shut down
216 * following execution of its agent's onRestore() method. Setting this attribute to
217 * <code>false</code> prevents this. Most applications will not need to set this attribute.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700218 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800219 * <p>If
220 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
221 * is set to <code>false</code> or no
222 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700223 * is specified, this flag will be ignored.
224 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800225 * <p>Comes from the
226 * {@link android.R.styleable#AndroidManifestApplication_killAfterRestore android:killAfterRestore}
227 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700228 */
Ben Cheng23085b72010-02-08 16:06:32 -0800229 public static final int FLAG_KILL_AFTER_RESTORE = 1<<16;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700230
231 /**
Christopher Tate3de55bc2010-03-12 17:28:08 -0800232 * Value for {@link #flags}: Set to <code>true</code> if the application's backup
233 * agent claims to be able to handle restore data even "from the future,"
234 * i.e. from versions of the application with a versionCode greater than
235 * the one currently installed on the device. <i>Use with caution!</i> By default
236 * this attribute is <code>false</code> and the Backup Manager will ensure that data
237 * from "future" versions of the application are never supplied during a restore operation.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700238 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800239 * <p>If
240 * {@link android.R.styleable#AndroidManifestApplication_allowBackup android:allowBackup}
241 * is set to <code>false</code> or no
242 * {@link android.R.styleable#AndroidManifestApplication_backupAgent android:backupAgent}
Christopher Tate5e1ab332009-09-01 20:32:49 -0700243 * is specified, this flag will be ignored.
244 *
Christopher Tate3de55bc2010-03-12 17:28:08 -0800245 * <p>Comes from the
246 * {@link android.R.styleable#AndroidManifestApplication_restoreAnyVersion android:restoreAnyVersion}
247 * attribute of the &lt;application&gt; tag.
Christopher Tate5e1ab332009-09-01 20:32:49 -0700248 */
Christopher Tate3de55bc2010-03-12 17:28:08 -0800249 public static final int FLAG_RESTORE_ANY_VERSION = 1<<17;
Christopher Tate5e1ab332009-09-01 20:32:49 -0700250
Christopher Tate181fafa2009-05-14 11:12:14 -0700251 /**
Oscar Montemayor1874aa42009-11-10 18:35:33 -0800252 * Value for {@link #flags}: this is true if the application has set
253 * its android:neverEncrypt to true, false otherwise. It is used to specify
254 * that this package specifically "opts-out" of a secured file system solution,
255 * and will always store its data in-the-clear.
256 *
257 * {@hide}
258 */
Ben Cheng23085b72010-02-08 16:06:32 -0800259 public static final int FLAG_NEVER_ENCRYPT = 1<<18;
Oscar Montemayor1874aa42009-11-10 18:35:33 -0800260
261 /**
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800262 * Value for {@link #flags}: Set to true if the application has been
263 * installed using the forward lock option.
264 *
265 * {@hide}
266 */
Ben Cheng23085b72010-02-08 16:06:32 -0800267 public static final int FLAG_FORWARD_LOCK = 1<<19;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800268
269 /**
270 * Value for {@link #flags}: Set to true if the application is
271 * currently installed on the sdcard.
272 *
273 * {@hide}
274 */
Suchi Amalapurapu6069beb2010-03-10 09:46:49 -0800275 public static final int FLAG_EXTERNAL_STORAGE = 1<<20;
Suchi Amalapurapuaf8e9f42010-01-12 10:17:28 -0800276
277 /**
David 'Digit' Turner1edab2b2010-01-21 15:15:23 -0800278 * Value for {@link #flags}: Set to true if the application is
279 * native-debuggable, i.e. embeds a gdbserver binary in its .apk
280 *
281 * {@hide}
282 */
Ben Cheng23085b72010-02-08 16:06:32 -0800283 public static final int FLAG_NATIVE_DEBUGGABLE = 1<<21;
David 'Digit' Turner1edab2b2010-01-21 15:15:23 -0800284
285 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286 * Flags associated with the application. Any combination of
287 * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
288 * {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
289 * {@link #FLAG_ALLOW_TASK_REPARENTING}
Dianne Hackborn851a5412009-05-08 12:06:44 -0700290 * {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
Dianne Hackborn723738c2009-06-25 19:48:04 -0700291 * {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
292 * {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
Christopher Tate5e1ab332009-09-01 20:32:49 -0700293 * {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS},
Ben Cheng23085b72010-02-08 16:06:32 -0800294 * {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}, {@link #FLAG_VM_SAFE_MODE}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 */
296 public int flags = 0;
297
298 /**
299 * Full path to the location of this package.
300 */
301 public String sourceDir;
302
303 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800304 * Full path to the location of the publicly available parts of this
305 * package (i.e. the primary resource package and manifest). For
306 * non-forward-locked apps this will be the same as {@link #sourceDir).
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 */
308 public String publicSourceDir;
309
310 /**
Kenny Rootd1ab0162010-01-21 17:27:14 -0800311 * Full paths to the locations of extra resource packages this application
312 * uses. This field is only used if there are extra resource packages,
313 * otherwise it is null.
Kenny Rootace5a3f2010-02-05 12:59:28 -0800314 *
315 * {@hide}
Kenny Rootd1ab0162010-01-21 17:27:14 -0800316 */
317 public String[] resourceDirs;
318
319 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320 * Paths to all shared libraries this application is linked against. This
321 * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
322 * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
323 * the structure.
324 */
325 public String[] sharedLibraryFiles;
326
327 /**
328 * Full path to a directory assigned to the package for its persistent
329 * data.
330 */
331 public String dataDir;
332
333 /**
334 * The kernel user-ID that has been assigned to this application;
335 * currently this is not a unique ID (multiple applications can have
336 * the same uid).
337 */
338 public int uid;
339
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700340 /**
Dianne Hackborn3b3e1452009-09-24 19:22:12 -0700341 * The minimum SDK version this application targets. It may run on earlier
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700342 * versions, but it knows how to work with any new behavior added at this
343 * version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
344 * if this is a development build and the app is targeting that. You should
345 * compare that this number is >= the SDK version number at which your
346 * behavior was introduced.
347 */
348 public int targetSdkVersion;
349
350 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 * When false, indicates that all components within this application are
352 * considered disabled, regardless of their individually set enabled status.
353 */
354 public boolean enabled = true;
355
356 public void dump(Printer pw, String prefix) {
357 super.dumpFront(pw, prefix);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800358 if (className != null) {
359 pw.println(prefix + "className=" + className);
360 }
361 if (permission != null) {
362 pw.println(prefix + "permission=" + permission);
363 }
364 pw.println(prefix + "uid=" + uid + " taskAffinity=" + taskAffinity);
365 if (theme != 0) {
366 pw.println(prefix + "theme=0x" + Integer.toHexString(theme));
367 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 pw.println(prefix + "flags=0x" + Integer.toHexString(flags)
369 + " processName=" + processName);
370 pw.println(prefix + "sourceDir=" + sourceDir);
371 pw.println(prefix + "publicSourceDir=" + publicSourceDir);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800372 pw.println(prefix + "resourceDirs=" + resourceDirs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 pw.println(prefix + "dataDir=" + dataDir);
Dianne Hackborn12527f92009-11-11 17:39:50 -0800374 if (sharedLibraryFiles != null) {
375 pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
376 }
377 pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion);
378 if (manageSpaceActivityName != null) {
379 pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
380 }
381 if (descriptionRes != 0) {
382 pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
383 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 super.dumpBack(pw, prefix);
385 }
386
387 public static class DisplayNameComparator
388 implements Comparator<ApplicationInfo> {
389 public DisplayNameComparator(PackageManager pm) {
390 mPM = pm;
391 }
392
393 public final int compare(ApplicationInfo aa, ApplicationInfo ab) {
394 CharSequence sa = mPM.getApplicationLabel(aa);
395 if (sa == null) {
396 sa = aa.packageName;
397 }
398 CharSequence sb = mPM.getApplicationLabel(ab);
399 if (sb == null) {
400 sb = ab.packageName;
401 }
402
403 return sCollator.compare(sa.toString(), sb.toString());
404 }
405
406 private final Collator sCollator = Collator.getInstance();
407 private PackageManager mPM;
408 }
409
410 public ApplicationInfo() {
411 }
412
413 public ApplicationInfo(ApplicationInfo orig) {
414 super(orig);
415 taskAffinity = orig.taskAffinity;
416 permission = orig.permission;
417 processName = orig.processName;
418 className = orig.className;
419 theme = orig.theme;
420 flags = orig.flags;
421 sourceDir = orig.sourceDir;
422 publicSourceDir = orig.publicSourceDir;
Kenny Rootd1ab0162010-01-21 17:27:14 -0800423 resourceDirs = orig.resourceDirs;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 sharedLibraryFiles = orig.sharedLibraryFiles;
425 dataDir = orig.dataDir;
426 uid = orig.uid;
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700427 targetSdkVersion = orig.targetSdkVersion;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 enabled = orig.enabled;
429 manageSpaceActivityName = orig.manageSpaceActivityName;
430 descriptionRes = orig.descriptionRes;
431 }
432
433
434 public String toString() {
435 return "ApplicationInfo{"
436 + Integer.toHexString(System.identityHashCode(this))
437 + " " + packageName + "}";
438 }
439
440 public int describeContents() {
441 return 0;
442 }
443
444 public void writeToParcel(Parcel dest, int parcelableFlags) {
445 super.writeToParcel(dest, parcelableFlags);
446 dest.writeString(taskAffinity);
447 dest.writeString(permission);
448 dest.writeString(processName);
449 dest.writeString(className);
450 dest.writeInt(theme);
451 dest.writeInt(flags);
452 dest.writeString(sourceDir);
453 dest.writeString(publicSourceDir);
Kenny Rootd1ab0162010-01-21 17:27:14 -0800454 dest.writeStringArray(resourceDirs);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 dest.writeStringArray(sharedLibraryFiles);
456 dest.writeString(dataDir);
457 dest.writeInt(uid);
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700458 dest.writeInt(targetSdkVersion);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 dest.writeInt(enabled ? 1 : 0);
460 dest.writeString(manageSpaceActivityName);
Christopher Tate181fafa2009-05-14 11:12:14 -0700461 dest.writeString(backupAgentName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 dest.writeInt(descriptionRes);
463 }
464
465 public static final Parcelable.Creator<ApplicationInfo> CREATOR
466 = new Parcelable.Creator<ApplicationInfo>() {
467 public ApplicationInfo createFromParcel(Parcel source) {
468 return new ApplicationInfo(source);
469 }
470 public ApplicationInfo[] newArray(int size) {
471 return new ApplicationInfo[size];
472 }
473 };
474
475 private ApplicationInfo(Parcel source) {
476 super(source);
477 taskAffinity = source.readString();
478 permission = source.readString();
479 processName = source.readString();
480 className = source.readString();
481 theme = source.readInt();
482 flags = source.readInt();
483 sourceDir = source.readString();
484 publicSourceDir = source.readString();
Kenny Rootd1ab0162010-01-21 17:27:14 -0800485 resourceDirs = source.readStringArray();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486 sharedLibraryFiles = source.readStringArray();
487 dataDir = source.readString();
488 uid = source.readInt();
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700489 targetSdkVersion = source.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 enabled = source.readInt() != 0;
491 manageSpaceActivityName = source.readString();
Christopher Tate181fafa2009-05-14 11:12:14 -0700492 backupAgentName = source.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 descriptionRes = source.readInt();
494 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -0700495
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800496 /**
497 * Retrieve the textual description of the application. This
498 * will call back on the given PackageManager to load the description from
499 * the application.
500 *
501 * @param pm A PackageManager from which the label can be loaded; usually
502 * the PackageManager from which you originally retrieved this item.
503 *
504 * @return Returns a CharSequence containing the application's description.
505 * If there is no description, null is returned.
506 */
507 public CharSequence loadDescription(PackageManager pm) {
508 if (descriptionRes != 0) {
509 CharSequence label = pm.getText(packageName, descriptionRes, null);
510 if (label != null) {
511 return label;
512 }
513 }
514 return null;
515 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700516
517 /**
518 * Disable compatibility mode
519 *
520 * @hide
521 */
522 public void disableCompatibilityMode() {
Mitsuru Oshima69fff4a2009-07-21 09:51:05 -0700523 flags |= (FLAG_SUPPORTS_LARGE_SCREENS | FLAG_SUPPORTS_NORMAL_SCREENS |
Dianne Hackborn11b822d2009-07-21 20:03:02 -0700524 FLAG_SUPPORTS_SMALL_SCREENS | FLAG_RESIZEABLE_FOR_SCREENS |
525 FLAG_SUPPORTS_SCREEN_DENSITIES);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -0700526 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527}