Home | History | Annotate | Download | only in pm
      1 /*
      2  * Copyright (C) 2006 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 
     17 package android.content.pm;
     18 
     19 import android.annotation.SdkConstant;
     20 import android.annotation.SdkConstant.SdkConstantType;
     21 import android.content.ComponentName;
     22 import android.content.Context;
     23 import android.content.Intent;
     24 import android.content.IntentFilter;
     25 import android.content.IntentSender;
     26 import android.content.pm.ManifestDigest;
     27 import android.content.res.Resources;
     28 import android.content.res.XmlResourceParser;
     29 import android.graphics.drawable.Drawable;
     30 import android.net.Uri;
     31 import android.util.AndroidException;
     32 import android.util.DisplayMetrics;
     33 
     34 import java.io.File;
     35 import java.util.List;
     36 
     37 /**
     38  * Class for retrieving various kinds of information related to the application
     39  * packages that are currently installed on the device.
     40  *
     41  * You can find this class through {@link Context#getPackageManager}.
     42  */
     43 public abstract class PackageManager {
     44 
     45     /**
     46      * This exception is thrown when a given package, application, or component
     47      * name can not be found.
     48      */
     49     public static class NameNotFoundException extends AndroidException {
     50         public NameNotFoundException() {
     51         }
     52 
     53         public NameNotFoundException(String name) {
     54             super(name);
     55         }
     56     }
     57 
     58     /**
     59      * {@link PackageInfo} flag: return information about
     60      * activities in the package in {@link PackageInfo#activities}.
     61      */
     62     public static final int GET_ACTIVITIES              = 0x00000001;
     63 
     64     /**
     65      * {@link PackageInfo} flag: return information about
     66      * intent receivers in the package in
     67      * {@link PackageInfo#receivers}.
     68      */
     69     public static final int GET_RECEIVERS               = 0x00000002;
     70 
     71     /**
     72      * {@link PackageInfo} flag: return information about
     73      * services in the package in {@link PackageInfo#services}.
     74      */
     75     public static final int GET_SERVICES                = 0x00000004;
     76 
     77     /**
     78      * {@link PackageInfo} flag: return information about
     79      * content providers in the package in
     80      * {@link PackageInfo#providers}.
     81      */
     82     public static final int GET_PROVIDERS               = 0x00000008;
     83 
     84     /**
     85      * {@link PackageInfo} flag: return information about
     86      * instrumentation in the package in
     87      * {@link PackageInfo#instrumentation}.
     88      */
     89     public static final int GET_INSTRUMENTATION         = 0x00000010;
     90 
     91     /**
     92      * {@link PackageInfo} flag: return information about the
     93      * intent filters supported by the activity.
     94      */
     95     public static final int GET_INTENT_FILTERS          = 0x00000020;
     96 
     97     /**
     98      * {@link PackageInfo} flag: return information about the
     99      * signatures included in the package.
    100      */
    101     public static final int GET_SIGNATURES          = 0x00000040;
    102 
    103     /**
    104      * {@link ResolveInfo} flag: return the IntentFilter that
    105      * was matched for a particular ResolveInfo in
    106      * {@link ResolveInfo#filter}.
    107      */
    108     public static final int GET_RESOLVED_FILTER         = 0x00000040;
    109 
    110     /**
    111      * {@link ComponentInfo} flag: return the {@link ComponentInfo#metaData}
    112      * data {@link android.os.Bundle}s that are associated with a component.
    113      * This applies for any API returning a ComponentInfo subclass.
    114      */
    115     public static final int GET_META_DATA               = 0x00000080;
    116 
    117     /**
    118      * {@link PackageInfo} flag: return the
    119      * {@link PackageInfo#gids group ids} that are associated with an
    120      * application.
    121      * This applies for any API returning an PackageInfo class, either
    122      * directly or nested inside of another.
    123      */
    124     public static final int GET_GIDS                    = 0x00000100;
    125 
    126     /**
    127      * {@link PackageInfo} flag: include disabled components in the returned info.
    128      */
    129     public static final int GET_DISABLED_COMPONENTS     = 0x00000200;
    130 
    131     /**
    132      * {@link ApplicationInfo} flag: return the
    133      * {@link ApplicationInfo#sharedLibraryFiles paths to the shared libraries}
    134      * that are associated with an application.
    135      * This applies for any API returning an ApplicationInfo class, either
    136      * directly or nested inside of another.
    137      */
    138     public static final int GET_SHARED_LIBRARY_FILES    = 0x00000400;
    139 
    140     /**
    141      * {@link ProviderInfo} flag: return the
    142      * {@link ProviderInfo#uriPermissionPatterns URI permission patterns}
    143      * that are associated with a content provider.
    144      * This applies for any API returning an ProviderInfo class, either
    145      * directly or nested inside of another.
    146      */
    147     public static final int GET_URI_PERMISSION_PATTERNS  = 0x00000800;
    148     /**
    149      * {@link PackageInfo} flag: return information about
    150      * permissions in the package in
    151      * {@link PackageInfo#permissions}.
    152      */
    153     public static final int GET_PERMISSIONS               = 0x00001000;
    154 
    155     /**
    156      * Flag parameter to retrieve some information about all applications (even
    157      * uninstalled ones) which have data directories. This state could have
    158      * resulted if applications have been deleted with flag
    159      * {@code DONT_DELETE_DATA} with a possibility of being replaced or
    160      * reinstalled in future.
    161      * <p>
    162      * Note: this flag may cause less information about currently installed
    163      * applications to be returned.
    164      */
    165     public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
    166 
    167     /**
    168      * {@link PackageInfo} flag: return information about
    169      * hardware preferences in
    170      * {@link PackageInfo#configPreferences PackageInfo.configPreferences} and
    171      * requested features in {@link PackageInfo#reqFeatures
    172      * PackageInfo.reqFeatures}.
    173      */
    174     public static final int GET_CONFIGURATIONS = 0x00004000;
    175 
    176     /**
    177      * Resolution and querying flag: if set, only filters that support the
    178      * {@link android.content.Intent#CATEGORY_DEFAULT} will be considered for
    179      * matching.  This is a synonym for including the CATEGORY_DEFAULT in your
    180      * supplied Intent.
    181      */
    182     public static final int MATCH_DEFAULT_ONLY   = 0x00010000;
    183 
    184     /**
    185      * Permission check result: this is returned by {@link #checkPermission}
    186      * if the permission has been granted to the given package.
    187      */
    188     public static final int PERMISSION_GRANTED = 0;
    189 
    190     /**
    191      * Permission check result: this is returned by {@link #checkPermission}
    192      * if the permission has not been granted to the given package.
    193      */
    194     public static final int PERMISSION_DENIED = -1;
    195 
    196     /**
    197      * Signature check result: this is returned by {@link #checkSignatures}
    198      * if all signatures on the two packages match.
    199      */
    200     public static final int SIGNATURE_MATCH = 0;
    201 
    202     /**
    203      * Signature check result: this is returned by {@link #checkSignatures}
    204      * if neither of the two packages is signed.
    205      */
    206     public static final int SIGNATURE_NEITHER_SIGNED = 1;
    207 
    208     /**
    209      * Signature check result: this is returned by {@link #checkSignatures}
    210      * if the first package is not signed but the second is.
    211      */
    212     public static final int SIGNATURE_FIRST_NOT_SIGNED = -1;
    213 
    214     /**
    215      * Signature check result: this is returned by {@link #checkSignatures}
    216      * if the second package is not signed but the first is.
    217      */
    218     public static final int SIGNATURE_SECOND_NOT_SIGNED = -2;
    219 
    220     /**
    221      * Signature check result: this is returned by {@link #checkSignatures}
    222      * if not all signatures on both packages match.
    223      */
    224     public static final int SIGNATURE_NO_MATCH = -3;
    225 
    226     /**
    227      * Signature check result: this is returned by {@link #checkSignatures}
    228      * if either of the packages are not valid.
    229      */
    230     public static final int SIGNATURE_UNKNOWN_PACKAGE = -4;
    231 
    232     /**
    233      * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
    234      * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
    235      * component or application is in its default enabled state (as specified
    236      * in its manifest).
    237      */
    238     public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0;
    239 
    240     /**
    241      * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
    242      * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
    243      * component or application has been explictily enabled, regardless of
    244      * what it has specified in its manifest.
    245      */
    246     public static final int COMPONENT_ENABLED_STATE_ENABLED = 1;
    247 
    248     /**
    249      * Flag for {@link #setApplicationEnabledSetting(String, int, int)}
    250      * and {@link #setComponentEnabledSetting(ComponentName, int, int)}: This
    251      * component or application has been explicitly disabled, regardless of
    252      * what it has specified in its manifest.
    253      */
    254     public static final int COMPONENT_ENABLED_STATE_DISABLED = 2;
    255 
    256     /**
    257      * Flag for {@link #setApplicationEnabledSetting(String, int, int)} only: The
    258      * user has explicitly disabled the application, regardless of what it has
    259      * specified in its manifest.  Because this is due to the user's request,
    260      * they may re-enable it if desired through the appropriate system UI.  This
    261      * option currently <strong>can not</strong> be used with
    262      * {@link #setComponentEnabledSetting(ComponentName, int, int)}.
    263      */
    264     public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
    265 
    266     /**
    267      * Flag parameter for {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} to
    268      * indicate that this package should be installed as forward locked, i.e. only the app itself
    269      * should have access to its code and non-resource assets.
    270      * @hide
    271      */
    272     public static final int INSTALL_FORWARD_LOCK = 0x00000001;
    273 
    274     /**
    275      * Flag parameter for {@link #installPackage} to indicate that you want to replace an already
    276      * installed package, if one exists.
    277      * @hide
    278      */
    279     public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
    280 
    281     /**
    282      * Flag parameter for {@link #installPackage} to indicate that you want to
    283      * allow test packages (those that have set android:testOnly in their
    284      * manifest) to be installed.
    285      * @hide
    286      */
    287     public static final int INSTALL_ALLOW_TEST = 0x00000004;
    288 
    289     /**
    290      * Flag parameter for {@link #installPackage} to indicate that this
    291      * package has to be installed on the sdcard.
    292      * @hide
    293      */
    294     public static final int INSTALL_EXTERNAL = 0x00000008;
    295 
    296     /**
    297      * Flag parameter for {@link #installPackage} to indicate that this package
    298      * has to be installed on the sdcard.
    299      * @hide
    300      */
    301     public static final int INSTALL_INTERNAL = 0x00000010;
    302 
    303     /**
    304      * Flag parameter for {@link #installPackage} to indicate that this install
    305      * was initiated via ADB.
    306      *
    307      * @hide
    308      */
    309     public static final int INSTALL_FROM_ADB = 0x00000020;
    310 
    311     /**
    312      * Flag parameter for
    313      * {@link #setComponentEnabledSetting(android.content.ComponentName, int, int)} to indicate
    314      * that you don't want to kill the app containing the component.  Be careful when you set this
    315      * since changing component states can make the containing application's behavior unpredictable.
    316      */
    317     public static final int DONT_KILL_APP = 0x00000001;
    318 
    319     /**
    320      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    321      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
    322      * @hide
    323      */
    324     public static final int INSTALL_SUCCEEDED = 1;
    325 
    326     /**
    327      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    328      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
    329      * already installed.
    330      * @hide
    331      */
    332     public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
    333 
    334     /**
    335      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    336      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
    337      * file is invalid.
    338      * @hide
    339      */
    340     public static final int INSTALL_FAILED_INVALID_APK = -2;
    341 
    342     /**
    343      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    344      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
    345      * is invalid.
    346      * @hide
    347      */
    348     public static final int INSTALL_FAILED_INVALID_URI = -3;
    349 
    350     /**
    351      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    352      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
    353      * service found that the device didn't have enough storage space to install the app.
    354      * @hide
    355      */
    356     public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
    357 
    358     /**
    359      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    360      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
    361      * package is already installed with the same name.
    362      * @hide
    363      */
    364     public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
    365 
    366     /**
    367      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    368      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    369      * the requested shared user does not exist.
    370      * @hide
    371      */
    372     public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
    373 
    374     /**
    375      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    376      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    377      * a previously installed package of the same name has a different signature
    378      * than the new package (and the old package's data was not removed).
    379      * @hide
    380      */
    381     public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
    382 
    383     /**
    384      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    385      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    386      * the new package is requested a shared user which is already installed on the
    387      * device and does not have matching signature.
    388      * @hide
    389      */
    390     public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
    391 
    392     /**
    393      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    394      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    395      * the new package uses a shared library that is not available.
    396      * @hide
    397      */
    398     public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
    399 
    400     /**
    401      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    402      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    403      * the new package uses a shared library that is not available.
    404      * @hide
    405      */
    406     public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
    407 
    408     /**
    409      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    410      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    411      * the new package failed while optimizing and validating its dex files,
    412      * either because there was not enough storage or the validation failed.
    413      * @hide
    414      */
    415     public static final int INSTALL_FAILED_DEXOPT = -11;
    416 
    417     /**
    418      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    419      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    420      * the new package failed because the current SDK version is older than
    421      * that required by the package.
    422      * @hide
    423      */
    424     public static final int INSTALL_FAILED_OLDER_SDK = -12;
    425 
    426     /**
    427      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    428      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    429      * the new package failed because it contains a content provider with the
    430      * same authority as a provider already installed in the system.
    431      * @hide
    432      */
    433     public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
    434 
    435     /**
    436      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    437      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    438      * the new package failed because the current SDK version is newer than
    439      * that required by the package.
    440      * @hide
    441      */
    442     public static final int INSTALL_FAILED_NEWER_SDK = -14;
    443 
    444     /**
    445      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    446      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    447      * the new package failed because it has specified that it is a test-only
    448      * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
    449      * flag.
    450      * @hide
    451      */
    452     public static final int INSTALL_FAILED_TEST_ONLY = -15;
    453 
    454     /**
    455      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    456      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    457      * the package being installed contains native code, but none that is
    458      * compatible with the the device's CPU_ABI.
    459      * @hide
    460      */
    461     public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
    462 
    463     /**
    464      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    465      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    466      * the new package uses a feature that is not available.
    467      * @hide
    468      */
    469     public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
    470 
    471     // ------ Errors related to sdcard
    472     /**
    473      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    474      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    475      * a secure container mount point couldn't be accessed on external media.
    476      * @hide
    477      */
    478     public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
    479 
    480     /**
    481      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    482      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    483      * the new package couldn't be installed in the specified install
    484      * location.
    485      * @hide
    486      */
    487     public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
    488 
    489     /**
    490      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    491      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    492      * the new package couldn't be installed in the specified install
    493      * location because the media is not available.
    494      * @hide
    495      */
    496     public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
    497 
    498     /**
    499      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    500      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    501      * the new package couldn't be installed because the verification timed out.
    502      * @hide
    503      */
    504     public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
    505 
    506     /**
    507      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    508      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    509      * the new package couldn't be installed because the verification did not succeed.
    510      * @hide
    511      */
    512     public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
    513 
    514     /**
    515      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
    516      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
    517      * the package changed from what the calling program expected.
    518      * @hide
    519      */
    520     public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
    521 
    522     /**
    523      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    524      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    525      * if the parser was given a path that is not a file, or does not end with the expected
    526      * '.apk' extension.
    527      * @hide
    528      */
    529     public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
    530 
    531     /**
    532      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    533      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    534      * if the parser was unable to retrieve the AndroidManifest.xml file.
    535      * @hide
    536      */
    537     public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
    538 
    539     /**
    540      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    541      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    542      * if the parser encountered an unexpected exception.
    543      * @hide
    544      */
    545     public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
    546 
    547     /**
    548      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    549      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    550      * if the parser did not find any certificates in the .apk.
    551      * @hide
    552      */
    553     public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
    554 
    555     /**
    556      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    557      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    558      * if the parser found inconsistent certificates on the files in the .apk.
    559      * @hide
    560      */
    561     public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
    562 
    563     /**
    564      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    565      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    566      * if the parser encountered a CertificateEncodingException in one of the
    567      * files in the .apk.
    568      * @hide
    569      */
    570     public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
    571 
    572     /**
    573      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    574      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    575      * if the parser encountered a bad or missing package name in the manifest.
    576      * @hide
    577      */
    578     public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
    579 
    580     /**
    581      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    582      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    583      * if the parser encountered a bad shared user id name in the manifest.
    584      * @hide
    585      */
    586     public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
    587 
    588     /**
    589      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    590      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    591      * if the parser encountered some structural problem in the manifest.
    592      * @hide
    593      */
    594     public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
    595 
    596     /**
    597      * Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
    598      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    599      * if the parser did not find any actionable tags (instrumentation or application)
    600      * in the manifest.
    601      * @hide
    602      */
    603     public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
    604 
    605     /**
    606      * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
    607      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
    608      * if the system failed to install the package because of system issues.
    609      * @hide
    610      */
    611     public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
    612 
    613     /**
    614      * Flag parameter for {@link #deletePackage} to indicate that you don't want to delete the
    615      * package's data directory.
    616      *
    617      * @hide
    618      */
    619     public static final int DONT_DELETE_DATA = 0x00000001;
    620 
    621     /**
    622      * Return code for when package deletion succeeds. This is passed to the
    623      * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
    624      * succeeded in deleting the package.
    625      *
    626      * @hide
    627      */
    628     public static final int DELETE_SUCCEEDED = 1;
    629 
    630     /**
    631      * Deletion failed return code: this is passed to the
    632      * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
    633      * failed to delete the package for an unspecified reason.
    634      *
    635      * @hide
    636      */
    637     public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
    638 
    639     /**
    640      * Deletion failed return code: this is passed to the
    641      * {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
    642      * failed to delete the package because it is the active DevicePolicy
    643      * manager.
    644      *
    645      * @hide
    646      */
    647     public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
    648 
    649     /**
    650      * Return code that is passed to the {@link IPackageMoveObserver} by
    651      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
    652      * package has been successfully moved by the system.
    653      *
    654      * @hide
    655      */
    656     public static final int MOVE_SUCCEEDED = 1;
    657     /**
    658      * Error code that is passed to the {@link IPackageMoveObserver} by
    659      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    660      * when the package hasn't been successfully moved by the system
    661      * because of insufficient memory on specified media.
    662      * @hide
    663      */
    664     public static final int MOVE_FAILED_INSUFFICIENT_STORAGE = -1;
    665 
    666     /**
    667      * Error code that is passed to the {@link IPackageMoveObserver} by
    668      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    669      * if the specified package doesn't exist.
    670      * @hide
    671      */
    672     public static final int MOVE_FAILED_DOESNT_EXIST = -2;
    673 
    674     /**
    675      * Error code that is passed to the {@link IPackageMoveObserver} by
    676      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    677      * if the specified package cannot be moved since its a system package.
    678      * @hide
    679      */
    680     public static final int MOVE_FAILED_SYSTEM_PACKAGE = -3;
    681 
    682     /**
    683      * Error code that is passed to the {@link IPackageMoveObserver} by
    684      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    685      * if the specified package cannot be moved since its forward locked.
    686      * @hide
    687      */
    688     public static final int MOVE_FAILED_FORWARD_LOCKED = -4;
    689 
    690     /**
    691      * Error code that is passed to the {@link IPackageMoveObserver} by
    692      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    693      * if the specified package cannot be moved to the specified location.
    694      * @hide
    695      */
    696     public static final int MOVE_FAILED_INVALID_LOCATION = -5;
    697 
    698     /**
    699      * Error code that is passed to the {@link IPackageMoveObserver} by
    700      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)}
    701      * if the specified package cannot be moved to the specified location.
    702      * @hide
    703      */
    704     public static final int MOVE_FAILED_INTERNAL_ERROR = -6;
    705 
    706     /**
    707      * Error code that is passed to the {@link IPackageMoveObserver} by
    708      * {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
    709      * specified package already has an operation pending in the
    710      * {@link PackageHandler} queue.
    711      *
    712      * @hide
    713      */
    714     public static final int MOVE_FAILED_OPERATION_PENDING = -7;
    715 
    716     /**
    717      * Flag parameter for {@link #movePackage} to indicate that
    718      * the package should be moved to internal storage if its
    719      * been installed on external media.
    720      * @hide
    721      */
    722     public static final int MOVE_INTERNAL = 0x00000001;
    723 
    724     /**
    725      * Flag parameter for {@link #movePackage} to indicate that
    726      * the package should be moved to external media.
    727      * @hide
    728      */
    729     public static final int MOVE_EXTERNAL_MEDIA = 0x00000002;
    730 
    731     /**
    732      * Usable by the required verifier as the {@code verificationCode} argument
    733      * for {@link PackageManager#verifyPendingInstall} to indicate that it will
    734      * allow the installation to proceed without any of the optional verifiers
    735      * needing to vote.
    736      *
    737      * @hide
    738      */
    739     public static final int VERIFICATION_ALLOW_WITHOUT_SUFFICIENT = 2;
    740 
    741     /**
    742      * Used as the {@code verificationCode} argument for
    743      * {@link PackageManager#verifyPendingInstall} to indicate that the calling
    744      * package verifier allows the installation to proceed.
    745      */
    746     public static final int VERIFICATION_ALLOW = 1;
    747 
    748     /**
    749      * Used as the {@code verificationCode} argument for
    750      * {@link PackageManager#verifyPendingInstall} to indicate the calling
    751      * package verifier does not vote to allow the installation to proceed.
    752      */
    753     public static final int VERIFICATION_REJECT = -1;
    754 
    755     /**
    756      * Range of IDs allocated for a user.
    757      *
    758      * @hide
    759      */
    760     public static final int PER_USER_RANGE = 100000;
    761 
    762     /**
    763      * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device's
    764      * audio pipeline is low-latency, more suitable for audio applications sensitive to delays or
    765      * lag in sound input or output.
    766      */
    767     @SdkConstant(SdkConstantType.FEATURE)
    768     public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
    769 
    770     /**
    771      * Feature for {@link #getSystemAvailableFeatures} and
    772      * {@link #hasSystemFeature}: The device is capable of communicating with
    773      * other devices via Bluetooth.
    774      */
    775     @SdkConstant(SdkConstantType.FEATURE)
    776     public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
    777 
    778     /**
    779      * Feature for {@link #getSystemAvailableFeatures} and
    780      * {@link #hasSystemFeature}: The device has a camera facing away
    781      * from the screen.
    782      */
    783     @SdkConstant(SdkConstantType.FEATURE)
    784     public static final String FEATURE_CAMERA = "android.hardware.camera";
    785 
    786     /**
    787      * Feature for {@link #getSystemAvailableFeatures} and
    788      * {@link #hasSystemFeature}: The device's camera supports auto-focus.
    789      */
    790     @SdkConstant(SdkConstantType.FEATURE)
    791     public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
    792 
    793     /**
    794      * Feature for {@link #getSystemAvailableFeatures} and
    795      * {@link #hasSystemFeature}: The device's camera supports flash.
    796      */
    797     @SdkConstant(SdkConstantType.FEATURE)
    798     public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
    799 
    800     /**
    801      * Feature for {@link #getSystemAvailableFeatures} and
    802      * {@link #hasSystemFeature}: The device has a front facing camera.
    803      */
    804     @SdkConstant(SdkConstantType.FEATURE)
    805     public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
    806 
    807     /**
    808      * Feature for {@link #getSystemAvailableFeatures} and
    809      * {@link #hasSystemFeature}: The device supports one or more methods of
    810      * reporting current location.
    811      */
    812     @SdkConstant(SdkConstantType.FEATURE)
    813     public static final String FEATURE_LOCATION = "android.hardware.location";
    814 
    815     /**
    816      * Feature for {@link #getSystemAvailableFeatures} and
    817      * {@link #hasSystemFeature}: The device has a Global Positioning System
    818      * receiver and can report precise location.
    819      */
    820     @SdkConstant(SdkConstantType.FEATURE)
    821     public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
    822 
    823     /**
    824      * Feature for {@link #getSystemAvailableFeatures} and
    825      * {@link #hasSystemFeature}: The device can report location with coarse
    826      * accuracy using a network-based geolocation system.
    827      */
    828     @SdkConstant(SdkConstantType.FEATURE)
    829     public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
    830 
    831     /**
    832      * Feature for {@link #getSystemAvailableFeatures} and
    833      * {@link #hasSystemFeature}: The device can record audio via a
    834      * microphone.
    835      */
    836     @SdkConstant(SdkConstantType.FEATURE)
    837     public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
    838 
    839     /**
    840      * Feature for {@link #getSystemAvailableFeatures} and
    841      * {@link #hasSystemFeature}: The device can communicate using Near-Field
    842      * Communications (NFC).
    843      */
    844     @SdkConstant(SdkConstantType.FEATURE)
    845     public static final String FEATURE_NFC = "android.hardware.nfc";
    846 
    847     /**
    848      * Feature for {@link #getSystemAvailableFeatures} and
    849      * {@link #hasSystemFeature}: The device includes an accelerometer.
    850      */
    851     @SdkConstant(SdkConstantType.FEATURE)
    852     public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
    853 
    854     /**
    855      * Feature for {@link #getSystemAvailableFeatures} and
    856      * {@link #hasSystemFeature}: The device includes a barometer (air
    857      * pressure sensor.)
    858      */
    859     @SdkConstant(SdkConstantType.FEATURE)
    860     public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
    861 
    862     /**
    863      * Feature for {@link #getSystemAvailableFeatures} and
    864      * {@link #hasSystemFeature}: The device includes a magnetometer (compass).
    865      */
    866     @SdkConstant(SdkConstantType.FEATURE)
    867     public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
    868 
    869     /**
    870      * Feature for {@link #getSystemAvailableFeatures} and
    871      * {@link #hasSystemFeature}: The device includes a gyroscope.
    872      */
    873     @SdkConstant(SdkConstantType.FEATURE)
    874     public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
    875 
    876     /**
    877      * Feature for {@link #getSystemAvailableFeatures} and
    878      * {@link #hasSystemFeature}: The device includes a light sensor.
    879      */
    880     @SdkConstant(SdkConstantType.FEATURE)
    881     public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
    882 
    883     /**
    884      * Feature for {@link #getSystemAvailableFeatures} and
    885      * {@link #hasSystemFeature}: The device includes a proximity sensor.
    886      */
    887     @SdkConstant(SdkConstantType.FEATURE)
    888     public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
    889 
    890     /**
    891      * Feature for {@link #getSystemAvailableFeatures} and
    892      * {@link #hasSystemFeature}: The device has a telephony radio with data
    893      * communication support.
    894      */
    895     @SdkConstant(SdkConstantType.FEATURE)
    896     public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
    897 
    898     /**
    899      * Feature for {@link #getSystemAvailableFeatures} and
    900      * {@link #hasSystemFeature}: The device has a CDMA telephony stack.
    901      */
    902     @SdkConstant(SdkConstantType.FEATURE)
    903     public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
    904 
    905     /**
    906      * Feature for {@link #getSystemAvailableFeatures} and
    907      * {@link #hasSystemFeature}: The device has a GSM telephony stack.
    908      */
    909     @SdkConstant(SdkConstantType.FEATURE)
    910     public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
    911 
    912     /**
    913      * Feature for {@link #getSystemAvailableFeatures} and
    914      * {@link #hasSystemFeature}: The device supports connecting to USB devices
    915      * as the USB host.
    916      */
    917     @SdkConstant(SdkConstantType.FEATURE)
    918     public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
    919 
    920     /**
    921      * Feature for {@link #getSystemAvailableFeatures} and
    922      * {@link #hasSystemFeature}: The device supports connecting to USB accessories.
    923      */
    924     @SdkConstant(SdkConstantType.FEATURE)
    925     public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
    926 
    927     /**
    928      * Feature for {@link #getSystemAvailableFeatures} and
    929      * {@link #hasSystemFeature}: The SIP API is enabled on the device.
    930      */
    931     @SdkConstant(SdkConstantType.FEATURE)
    932     public static final String FEATURE_SIP = "android.software.sip";
    933 
    934     /**
    935      * Feature for {@link #getSystemAvailableFeatures} and
    936      * {@link #hasSystemFeature}: The device supports SIP-based VOIP.
    937      */
    938     @SdkConstant(SdkConstantType.FEATURE)
    939     public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
    940 
    941     /**
    942      * Feature for {@link #getSystemAvailableFeatures} and
    943      * {@link #hasSystemFeature}: The device's display has a touch screen.
    944      */
    945     @SdkConstant(SdkConstantType.FEATURE)
    946     public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
    947 
    948 
    949     /**
    950      * Feature for {@link #getSystemAvailableFeatures} and
    951      * {@link #hasSystemFeature}: The device's touch screen supports
    952      * multitouch sufficient for basic two-finger gesture detection.
    953      */
    954     @SdkConstant(SdkConstantType.FEATURE)
    955     public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
    956 
    957     /**
    958      * Feature for {@link #getSystemAvailableFeatures} and
    959      * {@link #hasSystemFeature}: The device's touch screen is capable of
    960      * tracking two or more fingers fully independently.
    961      */
    962     @SdkConstant(SdkConstantType.FEATURE)
    963     public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
    964 
    965     /**
    966      * Feature for {@link #getSystemAvailableFeatures} and
    967      * {@link #hasSystemFeature}: The device's touch screen is capable of
    968      * tracking a full hand of fingers fully independently -- that is, 5 or
    969      * more simultaneous independent pointers.
    970      */
    971     @SdkConstant(SdkConstantType.FEATURE)
    972     public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
    973 
    974     /**
    975      * Feature for {@link #getSystemAvailableFeatures} and
    976      * {@link #hasSystemFeature}: The device does not have a touch screen, but
    977      * does support touch emulation for basic events. For instance, the
    978      * device might use a mouse or remote control to drive a cursor, and
    979      * emulate basic touch pointer events like down, up, drag, etc. All
    980      * devices that support android.hardware.touchscreen or a sub-feature are
    981      * presumed to also support faketouch.
    982      */
    983     @SdkConstant(SdkConstantType.FEATURE)
    984     public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
    985 
    986     /**
    987      * Feature for {@link #getSystemAvailableFeatures} and
    988      * {@link #hasSystemFeature}: The device does not have a touch screen, but
    989      * does support touch emulation for basic events that supports distinct
    990      * tracking of two or more fingers.  This is an extension of
    991      * {@link #FEATURE_FAKETOUCH} for input devices with this capability.  Note
    992      * that unlike a distinct multitouch screen as defined by
    993      * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT}, these kinds of input
    994      * devices will not actually provide full two-finger gestures since the
    995      * input is being transformed to cursor movement on the screen.  That is,
    996      * single finger gestures will move a cursor; two-finger swipes will
    997      * result in single-finger touch events; other two-finger gestures will
    998      * result in the corresponding two-finger touch event.
    999      */
   1000     @SdkConstant(SdkConstantType.FEATURE)
   1001     public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
   1002 
   1003     /**
   1004      * Feature for {@link #getSystemAvailableFeatures} and
   1005      * {@link #hasSystemFeature}: The device does not have a touch screen, but
   1006      * does support touch emulation for basic events that supports tracking
   1007      * a hand of fingers (5 or more fingers) fully independently.
   1008      * This is an extension of
   1009      * {@link #FEATURE_FAKETOUCH} for input devices with this capability.  Note
   1010      * that unlike a multitouch screen as defined by
   1011      * {@link #FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND}, not all two finger
   1012      * gestures can be detected due to the limitations described for
   1013      * {@link #FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT}.
   1014      */
   1015     @SdkConstant(SdkConstantType.FEATURE)
   1016     public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
   1017 
   1018     /**
   1019      * Feature for {@link #getSystemAvailableFeatures} and
   1020      * {@link #hasSystemFeature}: The device supports portrait orientation
   1021      * screens.  For backwards compatibility, you can assume that if neither
   1022      * this nor {@link #FEATURE_SCREEN_LANDSCAPE} is set then the device supports
   1023      * both portrait and landscape.
   1024      */
   1025     @SdkConstant(SdkConstantType.FEATURE)
   1026     public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
   1027 
   1028     /**
   1029      * Feature for {@link #getSystemAvailableFeatures} and
   1030      * {@link #hasSystemFeature}: The device supports landscape orientation
   1031      * screens.  For backwards compatibility, you can assume that if neither
   1032      * this nor {@link #FEATURE_SCREEN_PORTRAIT} is set then the device supports
   1033      * both portrait and landscape.
   1034      */
   1035     @SdkConstant(SdkConstantType.FEATURE)
   1036     public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
   1037 
   1038     /**
   1039      * Feature for {@link #getSystemAvailableFeatures} and
   1040      * {@link #hasSystemFeature}: The device supports live wallpapers.
   1041      */
   1042     @SdkConstant(SdkConstantType.FEATURE)
   1043     public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
   1044 
   1045     /**
   1046      * Feature for {@link #getSystemAvailableFeatures} and
   1047      * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
   1048      */
   1049     @SdkConstant(SdkConstantType.FEATURE)
   1050     public static final String FEATURE_WIFI = "android.hardware.wifi";
   1051 
   1052     /**
   1053      * Feature for {@link #getSystemAvailableFeatures} and
   1054      * {@link #hasSystemFeature}: The device supports Wi-Fi Direct networking.
   1055      */
   1056     @SdkConstant(SdkConstantType.FEATURE)
   1057     public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
   1058 
   1059     /**
   1060      * Action to external storage service to clean out removed apps.
   1061      * @hide
   1062      */
   1063     public static final String ACTION_CLEAN_EXTERNAL_STORAGE
   1064             = "android.content.pm.CLEAN_EXTERNAL_STORAGE";
   1065 
   1066     /**
   1067      * Extra field name for the URI to a verification file. Passed to a package
   1068      * verifier.
   1069      *
   1070      * @hide
   1071      */
   1072     public static final String EXTRA_VERIFICATION_URI = "android.content.pm.extra.VERIFICATION_URI";
   1073 
   1074     /**
   1075      * Extra field name for the ID of a package pending verification. Passed to
   1076      * a package verifier and is used to call back to
   1077      * {@link PackageManager#verifyPendingInstall(int, int)}
   1078      */
   1079     public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
   1080 
   1081     /**
   1082      * Extra field name for the package identifier which is trying to install
   1083      * the package.
   1084      *
   1085      * @hide
   1086      */
   1087     public static final String EXTRA_VERIFICATION_INSTALLER_PACKAGE
   1088             = "android.content.pm.extra.VERIFICATION_INSTALLER_PACKAGE";
   1089 
   1090     /**
   1091      * Extra field name for the requested install flags for a package pending
   1092      * verification. Passed to a package verifier.
   1093      *
   1094      * @hide
   1095      */
   1096     public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
   1097             = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
   1098 
   1099     /**
   1100      * Retrieve overall information about an application package that is
   1101      * installed on the system.
   1102      * <p>
   1103      * Throws {@link NameNotFoundException} if a package with the given name can
   1104      * not be found on the system.
   1105      *
   1106      * @param packageName The full name (i.e. com.google.apps.contacts) of the
   1107      *            desired package.
   1108      * @param flags Additional option flags. Use any combination of
   1109      *            {@link #GET_ACTIVITIES}, {@link #GET_GIDS},
   1110      *            {@link #GET_CONFIGURATIONS}, {@link #GET_INSTRUMENTATION},
   1111      *            {@link #GET_PERMISSIONS}, {@link #GET_PROVIDERS},
   1112      *            {@link #GET_RECEIVERS}, {@link #GET_SERVICES},
   1113      *            {@link #GET_SIGNATURES}, {@link #GET_UNINSTALLED_PACKAGES} to
   1114      *            modify the data returned.
   1115      * @return Returns a PackageInfo object containing information about the
   1116      *         package. If flag GET_UNINSTALLED_PACKAGES is set and if the
   1117      *         package is not found in the list of installed applications, the
   1118      *         package information is retrieved from the list of uninstalled
   1119      *         applications(which includes installed applications as well as
   1120      *         applications with data directory ie applications which had been
   1121      *         deleted with DONT_DELTE_DATA flag set).
   1122      * @see #GET_ACTIVITIES
   1123      * @see #GET_GIDS
   1124      * @see #GET_CONFIGURATIONS
   1125      * @see #GET_INSTRUMENTATION
   1126      * @see #GET_PERMISSIONS
   1127      * @see #GET_PROVIDERS
   1128      * @see #GET_RECEIVERS
   1129      * @see #GET_SERVICES
   1130      * @see #GET_SIGNATURES
   1131      * @see #GET_UNINSTALLED_PACKAGES
   1132      */
   1133     public abstract PackageInfo getPackageInfo(String packageName, int flags)
   1134             throws NameNotFoundException;
   1135 
   1136     /**
   1137      * Map from the current package names in use on the device to whatever
   1138      * the current canonical name of that package is.
   1139      * @param names Array of current names to be mapped.
   1140      * @return Returns an array of the same size as the original, containing
   1141      * the canonical name for each package.
   1142      */
   1143     public abstract String[] currentToCanonicalPackageNames(String[] names);
   1144 
   1145     /**
   1146      * Map from a packages canonical name to the current name in use on the device.
   1147      * @param names Array of new names to be mapped.
   1148      * @return Returns an array of the same size as the original, containing
   1149      * the current name for each package.
   1150      */
   1151     public abstract String[] canonicalToCurrentPackageNames(String[] names);
   1152 
   1153     /**
   1154      * Return a "good" intent to launch a front-door activity in a package,
   1155      * for use for example to implement an "open" button when browsing through
   1156      * packages.  The current implementation will look first for a main
   1157      * activity in the category {@link Intent#CATEGORY_INFO}, next for a
   1158      * main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return
   1159      * null if neither are found.
   1160      *
   1161      * <p>Throws {@link NameNotFoundException} if a package with the given
   1162      * name can not be found on the system.
   1163      *
   1164      * @param packageName The name of the package to inspect.
   1165      *
   1166      * @return Returns either a fully-qualified Intent that can be used to
   1167      * launch the main activity in the package, or null if the package does
   1168      * not contain such an activity.
   1169      */
   1170     public abstract Intent getLaunchIntentForPackage(String packageName);
   1171 
   1172     /**
   1173      * Return an array of all of the secondary group-ids that have been
   1174      * assigned to a package.
   1175      *
   1176      * <p>Throws {@link NameNotFoundException} if a package with the given
   1177      * name can not be found on the system.
   1178      *
   1179      * @param packageName The full name (i.e. com.google.apps.contacts) of the
   1180      *                    desired package.
   1181      *
   1182      * @return Returns an int array of the assigned gids, or null if there
   1183      * are none.
   1184      */
   1185     public abstract int[] getPackageGids(String packageName)
   1186             throws NameNotFoundException;
   1187 
   1188     /**
   1189      * Retrieve all of the information we know about a particular permission.
   1190      *
   1191      * <p>Throws {@link NameNotFoundException} if a permission with the given
   1192      * name can not be found on the system.
   1193      *
   1194      * @param name The fully qualified name (i.e. com.google.permission.LOGIN)
   1195      *             of the permission you are interested in.
   1196      * @param flags Additional option flags.  Use {@link #GET_META_DATA} to
   1197      * retrieve any meta-data associated with the permission.
   1198      *
   1199      * @return Returns a {@link PermissionInfo} containing information about the
   1200      *         permission.
   1201      */
   1202     public abstract PermissionInfo getPermissionInfo(String name, int flags)
   1203             throws NameNotFoundException;
   1204 
   1205     /**
   1206      * Query for all of the permissions associated with a particular group.
   1207      *
   1208      * <p>Throws {@link NameNotFoundException} if the given group does not
   1209      * exist.
   1210      *
   1211      * @param group The fully qualified name (i.e. com.google.permission.LOGIN)
   1212      *             of the permission group you are interested in.  Use null to
   1213      *             find all of the permissions not associated with a group.
   1214      * @param flags Additional option flags.  Use {@link #GET_META_DATA} to
   1215      * retrieve any meta-data associated with the permissions.
   1216      *
   1217      * @return Returns a list of {@link PermissionInfo} containing information
   1218      * about all of the permissions in the given group.
   1219      */
   1220     public abstract List<PermissionInfo> queryPermissionsByGroup(String group,
   1221             int flags) throws NameNotFoundException;
   1222 
   1223     /**
   1224      * Retrieve all of the information we know about a particular group of
   1225      * permissions.
   1226      *
   1227      * <p>Throws {@link NameNotFoundException} if a permission group with the given
   1228      * name can not be found on the system.
   1229      *
   1230      * @param name The fully qualified name (i.e. com.google.permission_group.APPS)
   1231      *             of the permission you are interested in.
   1232      * @param flags Additional option flags.  Use {@link #GET_META_DATA} to
   1233      * retrieve any meta-data associated with the permission group.
   1234      *
   1235      * @return Returns a {@link PermissionGroupInfo} containing information
   1236      * about the permission.
   1237      */
   1238     public abstract PermissionGroupInfo getPermissionGroupInfo(String name,
   1239             int flags) throws NameNotFoundException;
   1240 
   1241     /**
   1242      * Retrieve all of the known permission groups in the system.
   1243      *
   1244      * @param flags Additional option flags.  Use {@link #GET_META_DATA} to
   1245      * retrieve any meta-data associated with the permission group.
   1246      *
   1247      * @return Returns a list of {@link PermissionGroupInfo} containing
   1248      * information about all of the known permission groups.
   1249      */
   1250     public abstract List<PermissionGroupInfo> getAllPermissionGroups(int flags);
   1251 
   1252     /**
   1253      * Retrieve all of the information we know about a particular
   1254      * package/application.
   1255      *
   1256      * <p>Throws {@link NameNotFoundException} if an application with the given
   1257      * package name can not be found on the system.
   1258      *
   1259      * @param packageName The full name (i.e. com.google.apps.contacts) of an
   1260      *                    application.
   1261      * @param flags Additional option flags. Use any combination of
   1262      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1263      * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
   1264      *
   1265      * @return  {@link ApplicationInfo} Returns ApplicationInfo object containing
   1266      *         information about the package.
   1267      *         If flag GET_UNINSTALLED_PACKAGES is set and  if the package is not
   1268      *         found in the list of installed applications,
   1269      *         the application information is retrieved from the
   1270      *         list of uninstalled applications(which includes
   1271      *         installed applications as well as applications
   1272      *         with data directory ie applications which had been
   1273      *         deleted with DONT_DELTE_DATA flag set).
   1274      *
   1275      * @see #GET_META_DATA
   1276      * @see #GET_SHARED_LIBRARY_FILES
   1277      * @see #GET_UNINSTALLED_PACKAGES
   1278      */
   1279     public abstract ApplicationInfo getApplicationInfo(String packageName,
   1280             int flags) throws NameNotFoundException;
   1281 
   1282     /**
   1283      * Retrieve all of the information we know about a particular activity
   1284      * class.
   1285      *
   1286      * <p>Throws {@link NameNotFoundException} if an activity with the given
   1287      * class name can not be found on the system.
   1288      *
   1289      * @param component The full component name (i.e.
   1290      * com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
   1291      * class.
   1292      * @param flags Additional option flags. Use any combination of
   1293      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1294      * to modify the data (in ApplicationInfo) returned.
   1295      *
   1296      * @return {@link ActivityInfo} containing information about the activity.
   1297      *
   1298      * @see #GET_INTENT_FILTERS
   1299      * @see #GET_META_DATA
   1300      * @see #GET_SHARED_LIBRARY_FILES
   1301      */
   1302     public abstract ActivityInfo getActivityInfo(ComponentName component,
   1303             int flags) throws NameNotFoundException;
   1304 
   1305     /**
   1306      * Retrieve all of the information we know about a particular receiver
   1307      * class.
   1308      *
   1309      * <p>Throws {@link NameNotFoundException} if a receiver with the given
   1310      * class name can not be found on the system.
   1311      *
   1312      * @param component The full component name (i.e.
   1313      * com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
   1314      * class.
   1315      * @param flags Additional option flags.  Use any combination of
   1316      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1317      * to modify the data returned.
   1318      *
   1319      * @return {@link ActivityInfo} containing information about the receiver.
   1320      *
   1321      * @see #GET_INTENT_FILTERS
   1322      * @see #GET_META_DATA
   1323      * @see #GET_SHARED_LIBRARY_FILES
   1324      */
   1325     public abstract ActivityInfo getReceiverInfo(ComponentName component,
   1326             int flags) throws NameNotFoundException;
   1327 
   1328     /**
   1329      * Retrieve all of the information we know about a particular service
   1330      * class.
   1331      *
   1332      * <p>Throws {@link NameNotFoundException} if a service with the given
   1333      * class name can not be found on the system.
   1334      *
   1335      * @param component The full component name (i.e.
   1336      * com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
   1337      * class.
   1338      * @param flags Additional option flags.  Use any combination of
   1339      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1340      * to modify the data returned.
   1341      *
   1342      * @return ServiceInfo containing information about the service.
   1343      *
   1344      * @see #GET_META_DATA
   1345      * @see #GET_SHARED_LIBRARY_FILES
   1346      */
   1347     public abstract ServiceInfo getServiceInfo(ComponentName component,
   1348             int flags) throws NameNotFoundException;
   1349 
   1350     /**
   1351      * Retrieve all of the information we know about a particular content
   1352      * provider class.
   1353      *
   1354      * <p>Throws {@link NameNotFoundException} if a provider with the given
   1355      * class name can not be found on the system.
   1356      *
   1357      * @param component The full component name (i.e.
   1358      * com.google.providers.media/com.google.providers.media.MediaProvider) of a
   1359      * ContentProvider class.
   1360      * @param flags Additional option flags.  Use any combination of
   1361      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1362      * to modify the data returned.
   1363      *
   1364      * @return ProviderInfo containing information about the service.
   1365      *
   1366      * @see #GET_META_DATA
   1367      * @see #GET_SHARED_LIBRARY_FILES
   1368      */
   1369     public abstract ProviderInfo getProviderInfo(ComponentName component,
   1370             int flags) throws NameNotFoundException;
   1371 
   1372     /**
   1373      * Return a List of all packages that are installed
   1374      * on the device.
   1375      *
   1376      * @param flags Additional option flags. Use any combination of
   1377      * {@link #GET_ACTIVITIES},
   1378      * {@link #GET_GIDS},
   1379      * {@link #GET_CONFIGURATIONS},
   1380      * {@link #GET_INSTRUMENTATION},
   1381      * {@link #GET_PERMISSIONS},
   1382      * {@link #GET_PROVIDERS},
   1383      * {@link #GET_RECEIVERS},
   1384      * {@link #GET_SERVICES},
   1385      * {@link #GET_SIGNATURES},
   1386      * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
   1387      *
   1388      * @return A List of PackageInfo objects, one for each package that is
   1389      *         installed on the device.  In the unlikely case of there being no
   1390      *         installed packages, an empty list is returned.
   1391      *         If flag GET_UNINSTALLED_PACKAGES is set, a list of all
   1392      *         applications including those deleted with DONT_DELETE_DATA
   1393      *         (partially installed apps with data directory) will be returned.
   1394      *
   1395      * @see #GET_ACTIVITIES
   1396      * @see #GET_GIDS
   1397      * @see #GET_CONFIGURATIONS
   1398      * @see #GET_INSTRUMENTATION
   1399      * @see #GET_PERMISSIONS
   1400      * @see #GET_PROVIDERS
   1401      * @see #GET_RECEIVERS
   1402      * @see #GET_SERVICES
   1403      * @see #GET_SIGNATURES
   1404      * @see #GET_UNINSTALLED_PACKAGES
   1405      *
   1406      */
   1407     public abstract List<PackageInfo> getInstalledPackages(int flags);
   1408 
   1409     /**
   1410      * Check whether a particular package has been granted a particular
   1411      * permission.
   1412      *
   1413      * @param permName The name of the permission you are checking for,
   1414      * @param pkgName The name of the package you are checking against.
   1415      *
   1416      * @return If the package has the permission, PERMISSION_GRANTED is
   1417      * returned.  If it does not have the permission, PERMISSION_DENIED
   1418      * is returned.
   1419      *
   1420      * @see #PERMISSION_GRANTED
   1421      * @see #PERMISSION_DENIED
   1422      */
   1423     public abstract int checkPermission(String permName, String pkgName);
   1424 
   1425     /**
   1426      * Add a new dynamic permission to the system.  For this to work, your
   1427      * package must have defined a permission tree through the
   1428      * {@link android.R.styleable#AndroidManifestPermissionTree
   1429      * &lt;permission-tree&gt;} tag in its manifest.  A package can only add
   1430      * permissions to trees that were defined by either its own package or
   1431      * another with the same user id; a permission is in a tree if it
   1432      * matches the name of the permission tree + ".": for example,
   1433      * "com.foo.bar" is a member of the permission tree "com.foo".
   1434      *
   1435      * <p>It is good to make your permission tree name descriptive, because you
   1436      * are taking possession of that entire set of permission names.  Thus, it
   1437      * must be under a domain you control, with a suffix that will not match
   1438      * any normal permissions that may be declared in any applications that
   1439      * are part of that domain.
   1440      *
   1441      * <p>New permissions must be added before
   1442      * any .apks are installed that use those permissions.  Permissions you
   1443      * add through this method are remembered across reboots of the device.
   1444      * If the given permission already exists, the info you supply here
   1445      * will be used to update it.
   1446      *
   1447      * @param info Description of the permission to be added.
   1448      *
   1449      * @return Returns true if a new permission was created, false if an
   1450      * existing one was updated.
   1451      *
   1452      * @throws SecurityException if you are not allowed to add the
   1453      * given permission name.
   1454      *
   1455      * @see #removePermission(String)
   1456      */
   1457     public abstract boolean addPermission(PermissionInfo info);
   1458 
   1459     /**
   1460      * Like {@link #addPermission(PermissionInfo)} but asynchronously
   1461      * persists the package manager state after returning from the call,
   1462      * allowing it to return quicker and batch a series of adds at the
   1463      * expense of no guarantee the added permission will be retained if
   1464      * the device is rebooted before it is written.
   1465      */
   1466     public abstract boolean addPermissionAsync(PermissionInfo info);
   1467 
   1468     /**
   1469      * Removes a permission that was previously added with
   1470      * {@link #addPermission(PermissionInfo)}.  The same ownership rules apply
   1471      * -- you are only allowed to remove permissions that you are allowed
   1472      * to add.
   1473      *
   1474      * @param name The name of the permission to remove.
   1475      *
   1476      * @throws SecurityException if you are not allowed to remove the
   1477      * given permission name.
   1478      *
   1479      * @see #addPermission(PermissionInfo)
   1480      */
   1481     public abstract void removePermission(String name);
   1482 
   1483     /**
   1484      * Compare the signatures of two packages to determine if the same
   1485      * signature appears in both of them.  If they do contain the same
   1486      * signature, then they are allowed special privileges when working
   1487      * with each other: they can share the same user-id, run instrumentation
   1488      * against each other, etc.
   1489      *
   1490      * @param pkg1 First package name whose signature will be compared.
   1491      * @param pkg2 Second package name whose signature will be compared.
   1492      *
   1493      * @return Returns an integer indicating whether all signatures on the
   1494      * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
   1495      * all signatures match or < 0 if there is not a match ({@link
   1496      * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
   1497      *
   1498      * @see #checkSignatures(int, int)
   1499      * @see #SIGNATURE_MATCH
   1500      * @see #SIGNATURE_NO_MATCH
   1501      * @see #SIGNATURE_UNKNOWN_PACKAGE
   1502      */
   1503     public abstract int checkSignatures(String pkg1, String pkg2);
   1504 
   1505     /**
   1506      * Like {@link #checkSignatures(String, String)}, but takes UIDs of
   1507      * the two packages to be checked.  This can be useful, for example,
   1508      * when doing the check in an IPC, where the UID is the only identity
   1509      * available.  It is functionally identical to determining the package
   1510      * associated with the UIDs and checking their signatures.
   1511      *
   1512      * @param uid1 First UID whose signature will be compared.
   1513      * @param uid2 Second UID whose signature will be compared.
   1514      *
   1515      * @return Returns an integer indicating whether all signatures on the
   1516      * two packages match. The value is >= 0 ({@link #SIGNATURE_MATCH}) if
   1517      * all signatures match or < 0 if there is not a match ({@link
   1518      * #SIGNATURE_NO_MATCH} or {@link #SIGNATURE_UNKNOWN_PACKAGE}).
   1519      *
   1520      * @see #checkSignatures(String, String)
   1521      * @see #SIGNATURE_MATCH
   1522      * @see #SIGNATURE_NO_MATCH
   1523      * @see #SIGNATURE_UNKNOWN_PACKAGE
   1524      */
   1525     public abstract int checkSignatures(int uid1, int uid2);
   1526 
   1527     /**
   1528      * Retrieve the names of all packages that are associated with a particular
   1529      * user id.  In most cases, this will be a single package name, the package
   1530      * that has been assigned that user id.  Where there are multiple packages
   1531      * sharing the same user id through the "sharedUserId" mechanism, all
   1532      * packages with that id will be returned.
   1533      *
   1534      * @param uid The user id for which you would like to retrieve the
   1535      * associated packages.
   1536      *
   1537      * @return Returns an array of one or more packages assigned to the user
   1538      * id, or null if there are no known packages with the given id.
   1539      */
   1540     public abstract String[] getPackagesForUid(int uid);
   1541 
   1542     /**
   1543      * Retrieve the official name associated with a user id.  This name is
   1544      * guaranteed to never change, though it is possibly for the underlying
   1545      * user id to be changed.  That is, if you are storing information about
   1546      * user ids in persistent storage, you should use the string returned
   1547      * by this function instead of the raw user-id.
   1548      *
   1549      * @param uid The user id for which you would like to retrieve a name.
   1550      * @return Returns a unique name for the given user id, or null if the
   1551      * user id is not currently assigned.
   1552      */
   1553     public abstract String getNameForUid(int uid);
   1554 
   1555     /**
   1556      * Return the user id associated with a shared user name. Multiple
   1557      * applications can specify a shared user name in their manifest and thus
   1558      * end up using a common uid. This might be used for new applications
   1559      * that use an existing shared user name and need to know the uid of the
   1560      * shared user.
   1561      *
   1562      * @param sharedUserName The shared user name whose uid is to be retrieved.
   1563      * @return Returns the uid associated with the shared user, or  NameNotFoundException
   1564      * if the shared user name is not being used by any installed packages
   1565      * @hide
   1566      */
   1567     public abstract int getUidForSharedUser(String sharedUserName)
   1568             throws NameNotFoundException;
   1569 
   1570     /**
   1571      * Return a List of all application packages that are installed on the
   1572      * device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
   1573      * applications including those deleted with DONT_DELETE_DATA(partially
   1574      * installed apps with data directory) will be returned.
   1575      *
   1576      * @param flags Additional option flags. Use any combination of
   1577      * {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
   1578      * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
   1579      *
   1580      * @return A List of ApplicationInfo objects, one for each application that
   1581      *         is installed on the device.  In the unlikely case of there being
   1582      *         no installed applications, an empty list is returned.
   1583      *         If flag GET_UNINSTALLED_PACKAGES is set, a list of all
   1584      *         applications including those deleted with DONT_DELETE_DATA
   1585      *         (partially installed apps with data directory) will be returned.
   1586      *
   1587      * @see #GET_META_DATA
   1588      * @see #GET_SHARED_LIBRARY_FILES
   1589      * @see #GET_UNINSTALLED_PACKAGES
   1590      */
   1591     public abstract List<ApplicationInfo> getInstalledApplications(int flags);
   1592 
   1593     /**
   1594      * Get a list of shared libraries that are available on the
   1595      * system.
   1596      *
   1597      * @return An array of shared library names that are
   1598      * available on the system, or null if none are installed.
   1599      *
   1600      */
   1601     public abstract String[] getSystemSharedLibraryNames();
   1602 
   1603     /**
   1604      * Get a list of features that are available on the
   1605      * system.
   1606      *
   1607      * @return An array of FeatureInfo classes describing the features
   1608      * that are available on the system, or null if there are none(!!).
   1609      */
   1610     public abstract FeatureInfo[] getSystemAvailableFeatures();
   1611 
   1612     /**
   1613      * Check whether the given feature name is one of the available
   1614      * features as returned by {@link #getSystemAvailableFeatures()}.
   1615      *
   1616      * @return Returns true if the devices supports the feature, else
   1617      * false.
   1618      */
   1619     public abstract boolean hasSystemFeature(String name);
   1620 
   1621     /**
   1622      * Determine the best action to perform for a given Intent.  This is how
   1623      * {@link Intent#resolveActivity} finds an activity if a class has not
   1624      * been explicitly specified.
   1625      *
   1626      * <p><em>Note:</em> if using an implicit Intent (without an explicit ComponentName
   1627      * specified), be sure to consider whether to set the {@link #MATCH_DEFAULT_ONLY}
   1628      * only flag.  You need to do so to resolve the activity in the same way
   1629      * that {@link android.content.Context#startActivity(Intent)} and
   1630      * {@link android.content.Intent#resolveActivity(PackageManager)
   1631      * Intent.resolveActivity(PackageManager)} do.</p>
   1632      *
   1633      * @param intent An intent containing all of the desired specification
   1634      *               (action, data, type, category, and/or component).
   1635      * @param flags Additional option flags.  The most important is
   1636      * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
   1637      * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
   1638      *
   1639      * @return Returns a ResolveInfo containing the final activity intent that
   1640      *         was determined to be the best action.  Returns null if no
   1641      *         matching activity was found. If multiple matching activities are
   1642      *         found and there is no default set, returns a ResolveInfo
   1643      *         containing something else, such as the activity resolver.
   1644      *
   1645      * @see #MATCH_DEFAULT_ONLY
   1646      * @see #GET_INTENT_FILTERS
   1647      * @see #GET_RESOLVED_FILTER
   1648      */
   1649     public abstract ResolveInfo resolveActivity(Intent intent, int flags);
   1650 
   1651     /**
   1652      * Retrieve all activities that can be performed for the given intent.
   1653      *
   1654      * @param intent The desired intent as per resolveActivity().
   1655      * @param flags Additional option flags.  The most important is
   1656      * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
   1657      * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
   1658      *
   1659      * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
   1660      *         Activity. These are ordered from best to worst match -- that
   1661      *         is, the first item in the list is what is returned by
   1662      *         {@link #resolveActivity}.  If there are no matching activities, an empty
   1663      *         list is returned.
   1664      *
   1665      * @see #MATCH_DEFAULT_ONLY
   1666      * @see #GET_INTENT_FILTERS
   1667      * @see #GET_RESOLVED_FILTER
   1668      */
   1669     public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
   1670             int flags);
   1671 
   1672     /**
   1673      * Retrieve a set of activities that should be presented to the user as
   1674      * similar options.  This is like {@link #queryIntentActivities}, except it
   1675      * also allows you to supply a list of more explicit Intents that you would
   1676      * like to resolve to particular options, and takes care of returning the
   1677      * final ResolveInfo list in a reasonable order, with no duplicates, based
   1678      * on those inputs.
   1679      *
   1680      * @param caller The class name of the activity that is making the
   1681      *               request.  This activity will never appear in the output
   1682      *               list.  Can be null.
   1683      * @param specifics An array of Intents that should be resolved to the
   1684      *                  first specific results.  Can be null.
   1685      * @param intent The desired intent as per resolveActivity().
   1686      * @param flags Additional option flags.  The most important is
   1687      * {@link #MATCH_DEFAULT_ONLY}, to limit the resolution to only
   1688      * those activities that support the {@link android.content.Intent#CATEGORY_DEFAULT}.
   1689      *
   1690      * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
   1691      *         Activity. These are ordered first by all of the intents resolved
   1692      *         in <var>specifics</var> and then any additional activities that
   1693      *         can handle <var>intent</var> but did not get included by one of
   1694      *         the <var>specifics</var> intents.  If there are no matching
   1695      *         activities, an empty list is returned.
   1696      *
   1697      * @see #MATCH_DEFAULT_ONLY
   1698      * @see #GET_INTENT_FILTERS
   1699      * @see #GET_RESOLVED_FILTER
   1700      */
   1701     public abstract List<ResolveInfo> queryIntentActivityOptions(
   1702             ComponentName caller, Intent[] specifics, Intent intent, int flags);
   1703 
   1704     /**
   1705      * Retrieve all receivers that can handle a broadcast of the given intent.
   1706      *
   1707      * @param intent The desired intent as per resolveActivity().
   1708      * @param flags Additional option flags.
   1709      *
   1710      * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
   1711      *         Receiver. These are ordered from first to last in priority.  If
   1712      *         there are no matching receivers, an empty list is returned.
   1713      *
   1714      * @see #MATCH_DEFAULT_ONLY
   1715      * @see #GET_INTENT_FILTERS
   1716      * @see #GET_RESOLVED_FILTER
   1717      */
   1718     public abstract List<ResolveInfo> queryBroadcastReceivers(Intent intent,
   1719             int flags);
   1720 
   1721     /**
   1722      * Determine the best service to handle for a given Intent.
   1723      *
   1724      * @param intent An intent containing all of the desired specification
   1725      *               (action, data, type, category, and/or component).
   1726      * @param flags Additional option flags.
   1727      *
   1728      * @return Returns a ResolveInfo containing the final service intent that
   1729      *         was determined to be the best action.  Returns null if no
   1730      *         matching service was found.
   1731      *
   1732      * @see #GET_INTENT_FILTERS
   1733      * @see #GET_RESOLVED_FILTER
   1734      */
   1735     public abstract ResolveInfo resolveService(Intent intent, int flags);
   1736 
   1737     /**
   1738      * Retrieve all services that can match the given intent.
   1739      *
   1740      * @param intent The desired intent as per resolveService().
   1741      * @param flags Additional option flags.
   1742      *
   1743      * @return A List&lt;ResolveInfo&gt; containing one entry for each matching
   1744      *         ServiceInfo. These are ordered from best to worst match -- that
   1745      *         is, the first item in the list is what is returned by
   1746      *         resolveService().  If there are no matching services, an empty
   1747      *         list is returned.
   1748      *
   1749      * @see #GET_INTENT_FILTERS
   1750      * @see #GET_RESOLVED_FILTER
   1751      */
   1752     public abstract List<ResolveInfo> queryIntentServices(Intent intent,
   1753             int flags);
   1754 
   1755     /**
   1756      * Find a single content provider by its base path name.
   1757      *
   1758      * @param name The name of the provider to find.
   1759      * @param flags Additional option flags.  Currently should always be 0.
   1760      *
   1761      * @return ContentProviderInfo Information about the provider, if found,
   1762      *         else null.
   1763      */
   1764     public abstract ProviderInfo resolveContentProvider(String name,
   1765             int flags);
   1766 
   1767     /**
   1768      * Retrieve content provider information.
   1769      *
   1770      * <p><em>Note: unlike most other methods, an empty result set is indicated
   1771      * by a null return instead of an empty list.</em>
   1772      *
   1773      * @param processName If non-null, limits the returned providers to only
   1774      *                    those that are hosted by the given process.  If null,
   1775      *                    all content providers are returned.
   1776      * @param uid If <var>processName</var> is non-null, this is the required
   1777      *        uid owning the requested content providers.
   1778      * @param flags Additional option flags.  Currently should always be 0.
   1779      *
   1780      * @return A List&lt;ContentProviderInfo&gt; containing one entry for each
   1781      *         content provider either patching <var>processName</var> or, if
   1782      *         <var>processName</var> is null, all known content providers.
   1783      *         <em>If there are no matching providers, null is returned.</em>
   1784      */
   1785     public abstract List<ProviderInfo> queryContentProviders(
   1786             String processName, int uid, int flags);
   1787 
   1788     /**
   1789      * Retrieve all of the information we know about a particular
   1790      * instrumentation class.
   1791      *
   1792      * <p>Throws {@link NameNotFoundException} if instrumentation with the
   1793      * given class name can not be found on the system.
   1794      *
   1795      * @param className The full name (i.e.
   1796      *                  com.google.apps.contacts.InstrumentList) of an
   1797      *                  Instrumentation class.
   1798      * @param flags Additional option flags.  Currently should always be 0.
   1799      *
   1800      * @return InstrumentationInfo containing information about the
   1801      *         instrumentation.
   1802      */
   1803     public abstract InstrumentationInfo getInstrumentationInfo(
   1804             ComponentName className, int flags) throws NameNotFoundException;
   1805 
   1806     /**
   1807      * Retrieve information about available instrumentation code.  May be used
   1808      * to retrieve either all instrumentation code, or only the code targeting
   1809      * a particular package.
   1810      *
   1811      * @param targetPackage If null, all instrumentation is returned; only the
   1812      *                      instrumentation targeting this package name is
   1813      *                      returned.
   1814      * @param flags Additional option flags.  Currently should always be 0.
   1815      *
   1816      * @return A List&lt;InstrumentationInfo&gt; containing one entry for each
   1817      *         matching available Instrumentation.  Returns an empty list if
   1818      *         there is no instrumentation available for the given package.
   1819      */
   1820     public abstract List<InstrumentationInfo> queryInstrumentation(
   1821             String targetPackage, int flags);
   1822 
   1823     /**
   1824      * Retrieve an image from a package.  This is a low-level API used by
   1825      * the various package manager info structures (such as
   1826      * {@link ComponentInfo} to implement retrieval of their associated
   1827      * icon.
   1828      *
   1829      * @param packageName The name of the package that this icon is coming from.
   1830      * Can not be null.
   1831      * @param resid The resource identifier of the desired image.  Can not be 0.
   1832      * @param appInfo Overall information about <var>packageName</var>.  This
   1833      * may be null, in which case the application information will be retrieved
   1834      * for you if needed; if you already have this information around, it can
   1835      * be much more efficient to supply it here.
   1836      *
   1837      * @return Returns a Drawable holding the requested image.  Returns null if
   1838      * an image could not be found for any reason.
   1839      */
   1840     public abstract Drawable getDrawable(String packageName, int resid,
   1841             ApplicationInfo appInfo);
   1842 
   1843     /**
   1844      * Retrieve the icon associated with an activity.  Given the full name of
   1845      * an activity, retrieves the information about it and calls
   1846      * {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
   1847      * If the activity can not be found, NameNotFoundException is thrown.
   1848      *
   1849      * @param activityName Name of the activity whose icon is to be retrieved.
   1850      *
   1851      * @return Returns the image of the icon, or the default activity icon if
   1852      * it could not be found.  Does not return null.
   1853      * @throws NameNotFoundException Thrown if the resources for the given
   1854      * activity could not be loaded.
   1855      *
   1856      * @see #getActivityIcon(Intent)
   1857      */
   1858     public abstract Drawable getActivityIcon(ComponentName activityName)
   1859             throws NameNotFoundException;
   1860 
   1861     /**
   1862      * Retrieve the icon associated with an Intent.  If intent.getClassName() is
   1863      * set, this simply returns the result of
   1864      * getActivityIcon(intent.getClassName()).  Otherwise it resolves the intent's
   1865      * component and returns the icon associated with the resolved component.
   1866      * If intent.getClassName() can not be found or the Intent can not be resolved
   1867      * to a component, NameNotFoundException is thrown.
   1868      *
   1869      * @param intent The intent for which you would like to retrieve an icon.
   1870      *
   1871      * @return Returns the image of the icon, or the default activity icon if
   1872      * it could not be found.  Does not return null.
   1873      * @throws NameNotFoundException Thrown if the resources for application
   1874      * matching the given intent could not be loaded.
   1875      *
   1876      * @see #getActivityIcon(ComponentName)
   1877      */
   1878     public abstract Drawable getActivityIcon(Intent intent)
   1879             throws NameNotFoundException;
   1880 
   1881     /**
   1882      * Return the generic icon for an activity that is used when no specific
   1883      * icon is defined.
   1884      *
   1885      * @return Drawable Image of the icon.
   1886      */
   1887     public abstract Drawable getDefaultActivityIcon();
   1888 
   1889     /**
   1890      * Retrieve the icon associated with an application.  If it has not defined
   1891      * an icon, the default app icon is returned.  Does not return null.
   1892      *
   1893      * @param info Information about application being queried.
   1894      *
   1895      * @return Returns the image of the icon, or the default application icon
   1896      * if it could not be found.
   1897      *
   1898      * @see #getApplicationIcon(String)
   1899      */
   1900     public abstract Drawable getApplicationIcon(ApplicationInfo info);
   1901 
   1902     /**
   1903      * Retrieve the icon associated with an application.  Given the name of the
   1904      * application's package, retrieves the information about it and calls
   1905      * getApplicationIcon() to return its icon. If the application can not be
   1906      * found, NameNotFoundException is thrown.
   1907      *
   1908      * @param packageName Name of the package whose application icon is to be
   1909      *                    retrieved.
   1910      *
   1911      * @return Returns the image of the icon, or the default application icon
   1912      * if it could not be found.  Does not return null.
   1913      * @throws NameNotFoundException Thrown if the resources for the given
   1914      * application could not be loaded.
   1915      *
   1916      * @see #getApplicationIcon(ApplicationInfo)
   1917      */
   1918     public abstract Drawable getApplicationIcon(String packageName)
   1919             throws NameNotFoundException;
   1920 
   1921     /**
   1922      * Retrieve the logo associated with an activity.  Given the full name of
   1923      * an activity, retrieves the information about it and calls
   1924      * {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo.
   1925      * If the activity can not be found, NameNotFoundException is thrown.
   1926      *
   1927      * @param activityName Name of the activity whose logo is to be retrieved.
   1928      *
   1929      * @return Returns the image of the logo or null if the activity has no
   1930      * logo specified.
   1931      *
   1932      * @throws NameNotFoundException Thrown if the resources for the given
   1933      * activity could not be loaded.
   1934      *
   1935      * @see #getActivityLogo(Intent)
   1936      */
   1937     public abstract Drawable getActivityLogo(ComponentName activityName)
   1938             throws NameNotFoundException;
   1939 
   1940     /**
   1941      * Retrieve the logo associated with an Intent.  If intent.getClassName() is
   1942      * set, this simply returns the result of
   1943      * getActivityLogo(intent.getClassName()).  Otherwise it resolves the intent's
   1944      * component and returns the logo associated with the resolved component.
   1945      * If intent.getClassName() can not be found or the Intent can not be resolved
   1946      * to a component, NameNotFoundException is thrown.
   1947      *
   1948      * @param intent The intent for which you would like to retrieve a logo.
   1949      *
   1950      * @return Returns the image of the logo, or null if the activity has no
   1951      * logo specified.
   1952      *
   1953      * @throws NameNotFoundException Thrown if the resources for application
   1954      * matching the given intent could not be loaded.
   1955      *
   1956      * @see #getActivityLogo(ComponentName)
   1957      */
   1958     public abstract Drawable getActivityLogo(Intent intent)
   1959             throws NameNotFoundException;
   1960 
   1961     /**
   1962      * Retrieve the logo associated with an application.  If it has not specified
   1963      * a logo, this method returns null.
   1964      *
   1965      * @param info Information about application being queried.
   1966      *
   1967      * @return Returns the image of the logo, or null if no logo is specified
   1968      * by the application.
   1969      *
   1970      * @see #getApplicationLogo(String)
   1971      */
   1972     public abstract Drawable getApplicationLogo(ApplicationInfo info);
   1973 
   1974     /**
   1975      * Retrieve the logo associated with an application.  Given the name of the
   1976      * application's package, retrieves the information about it and calls
   1977      * getApplicationLogo() to return its logo. If the application can not be
   1978      * found, NameNotFoundException is thrown.
   1979      *
   1980      * @param packageName Name of the package whose application logo is to be
   1981      *                    retrieved.
   1982      *
   1983      * @return Returns the image of the logo, or null if no application logo
   1984      * has been specified.
   1985      *
   1986      * @throws NameNotFoundException Thrown if the resources for the given
   1987      * application could not be loaded.
   1988      *
   1989      * @see #getApplicationLogo(ApplicationInfo)
   1990      */
   1991     public abstract Drawable getApplicationLogo(String packageName)
   1992             throws NameNotFoundException;
   1993 
   1994     /**
   1995      * Retrieve text from a package.  This is a low-level API used by
   1996      * the various package manager info structures (such as
   1997      * {@link ComponentInfo} to implement retrieval of their associated
   1998      * labels and other text.
   1999      *
   2000      * @param packageName The name of the package that this text is coming from.
   2001      * Can not be null.
   2002      * @param resid The resource identifier of the desired text.  Can not be 0.
   2003      * @param appInfo Overall information about <var>packageName</var>.  This
   2004      * may be null, in which case the application information will be retrieved
   2005      * for you if needed; if you already have this information around, it can
   2006      * be much more efficient to supply it here.
   2007      *
   2008      * @return Returns a CharSequence holding the requested text.  Returns null
   2009      * if the text could not be found for any reason.
   2010      */
   2011     public abstract CharSequence getText(String packageName, int resid,
   2012             ApplicationInfo appInfo);
   2013 
   2014     /**
   2015      * Retrieve an XML file from a package.  This is a low-level API used to
   2016      * retrieve XML meta data.
   2017      *
   2018      * @param packageName The name of the package that this xml is coming from.
   2019      * Can not be null.
   2020      * @param resid The resource identifier of the desired xml.  Can not be 0.
   2021      * @param appInfo Overall information about <var>packageName</var>.  This
   2022      * may be null, in which case the application information will be retrieved
   2023      * for you if needed; if you already have this information around, it can
   2024      * be much more efficient to supply it here.
   2025      *
   2026      * @return Returns an XmlPullParser allowing you to parse out the XML
   2027      * data.  Returns null if the xml resource could not be found for any
   2028      * reason.
   2029      */
   2030     public abstract XmlResourceParser getXml(String packageName, int resid,
   2031             ApplicationInfo appInfo);
   2032 
   2033     /**
   2034      * Return the label to use for this application.
   2035      *
   2036      * @return Returns the label associated with this application, or null if
   2037      * it could not be found for any reason.
   2038      * @param info The application to get the label of
   2039      */
   2040     public abstract CharSequence getApplicationLabel(ApplicationInfo info);
   2041 
   2042     /**
   2043      * Retrieve the resources associated with an activity.  Given the full
   2044      * name of an activity, retrieves the information about it and calls
   2045      * getResources() to return its application's resources.  If the activity
   2046      * can not be found, NameNotFoundException is thrown.
   2047      *
   2048      * @param activityName Name of the activity whose resources are to be
   2049      *                     retrieved.
   2050      *
   2051      * @return Returns the application's Resources.
   2052      * @throws NameNotFoundException Thrown if the resources for the given
   2053      * application could not be loaded.
   2054      *
   2055      * @see #getResourcesForApplication(ApplicationInfo)
   2056      */
   2057     public abstract Resources getResourcesForActivity(ComponentName activityName)
   2058             throws NameNotFoundException;
   2059 
   2060     /**
   2061      * Retrieve the resources for an application.  Throws NameNotFoundException
   2062      * if the package is no longer installed.
   2063      *
   2064      * @param app Information about the desired application.
   2065      *
   2066      * @return Returns the application's Resources.
   2067      * @throws NameNotFoundException Thrown if the resources for the given
   2068      * application could not be loaded (most likely because it was uninstalled).
   2069      */
   2070     public abstract Resources getResourcesForApplication(ApplicationInfo app)
   2071             throws NameNotFoundException;
   2072 
   2073     /**
   2074      * Retrieve the resources associated with an application.  Given the full
   2075      * package name of an application, retrieves the information about it and
   2076      * calls getResources() to return its application's resources.  If the
   2077      * appPackageName can not be found, NameNotFoundException is thrown.
   2078      *
   2079      * @param appPackageName Package name of the application whose resources
   2080      *                       are to be retrieved.
   2081      *
   2082      * @return Returns the application's Resources.
   2083      * @throws NameNotFoundException Thrown if the resources for the given
   2084      * application could not be loaded.
   2085      *
   2086      * @see #getResourcesForApplication(ApplicationInfo)
   2087      */
   2088     public abstract Resources getResourcesForApplication(String appPackageName)
   2089             throws NameNotFoundException;
   2090 
   2091     /**
   2092      * Retrieve overall information about an application package defined
   2093      * in a package archive file
   2094      *
   2095      * @param archiveFilePath The path to the archive file
   2096      * @param flags Additional option flags. Use any combination of
   2097      * {@link #GET_ACTIVITIES},
   2098      * {@link #GET_GIDS},
   2099      * {@link #GET_CONFIGURATIONS},
   2100      * {@link #GET_INSTRUMENTATION},
   2101      * {@link #GET_PERMISSIONS},
   2102      * {@link #GET_PROVIDERS},
   2103      * {@link #GET_RECEIVERS},
   2104      * {@link #GET_SERVICES},
   2105      * {@link #GET_SIGNATURES}, to modify the data returned.
   2106      *
   2107      * @return Returns the information about the package. Returns
   2108      * null if the package could not be successfully parsed.
   2109      *
   2110      * @see #GET_ACTIVITIES
   2111      * @see #GET_GIDS
   2112      * @see #GET_CONFIGURATIONS
   2113      * @see #GET_INSTRUMENTATION
   2114      * @see #GET_PERMISSIONS
   2115      * @see #GET_PROVIDERS
   2116      * @see #GET_RECEIVERS
   2117      * @see #GET_SERVICES
   2118      * @see #GET_SIGNATURES
   2119      *
   2120      */
   2121     public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
   2122         PackageParser packageParser = new PackageParser(archiveFilePath);
   2123         DisplayMetrics metrics = new DisplayMetrics();
   2124         metrics.setToDefaults();
   2125         final File sourceFile = new File(archiveFilePath);
   2126         PackageParser.Package pkg = packageParser.parsePackage(
   2127                 sourceFile, archiveFilePath, metrics, 0);
   2128         if (pkg == null) {
   2129             return null;
   2130         }
   2131         if ((flags & GET_SIGNATURES) != 0) {
   2132             packageParser.collectCertificates(pkg, 0);
   2133         }
   2134         return PackageParser.generatePackageInfo(pkg, null, flags, 0, 0);
   2135     }
   2136 
   2137     /**
   2138      * @hide
   2139      *
   2140      * Install a package. Since this may take a little while, the result will
   2141      * be posted back to the given observer.  An installation will fail if the calling context
   2142      * lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
   2143      * package named in the package file's manifest is already installed, or if there's no space
   2144      * available on the device.
   2145      *
   2146      * @param packageURI The location of the package file to install.  This can be a 'file:' or a
   2147      * 'content:' URI.
   2148      * @param observer An observer callback to get notified when the package installation is
   2149      * complete. {@link IPackageInstallObserver#packageInstalled(String, int)} will be
   2150      * called when that happens.  observer may be null to indicate that no callback is desired.
   2151      * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
   2152      * {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}.
   2153      * @param installerPackageName Optional package name of the application that is performing the
   2154      * installation. This identifies which market the package came from.
   2155      */
   2156     public abstract void installPackage(
   2157             Uri packageURI, IPackageInstallObserver observer, int flags,
   2158             String installerPackageName);
   2159 
   2160     /**
   2161      * Similar to
   2162      * {@link #installPackage(Uri, IPackageInstallObserver, int, String)} but
   2163      * with an extra verification file provided.
   2164      *
   2165      * @param packageURI The location of the package file to install. This can
   2166      *            be a 'file:' or a 'content:' URI.
   2167      * @param observer An observer callback to get notified when the package
   2168      *            installation is complete.
   2169      *            {@link IPackageInstallObserver#packageInstalled(String, int)}
   2170      *            will be called when that happens. observer may be null to
   2171      *            indicate that no callback is desired.
   2172      * @param flags - possible values: {@link #INSTALL_FORWARD_LOCK},
   2173      *            {@link #INSTALL_REPLACE_EXISTING}, {@link #INSTALL_ALLOW_TEST}
   2174      *            .
   2175      * @param installerPackageName Optional package name of the application that
   2176      *            is performing the installation. This identifies which market
   2177      *            the package came from.
   2178      * @param verificationURI The location of the supplementary verification
   2179      *            file. This can be a 'file:' or a 'content:' URI.
   2180      * @hide
   2181      */
   2182     public abstract void installPackageWithVerification(Uri packageURI,
   2183             IPackageInstallObserver observer, int flags, String installerPackageName,
   2184             Uri verificationURI, ManifestDigest manifestDigest);
   2185 
   2186     /**
   2187      * Allows a package listening to the
   2188      * {@link Intent#ACTION_PACKAGE_NEEDS_VERIFICATION package verification
   2189      * broadcast} to respond to the package manager. The response must include
   2190      * the {@code verificationCode} which is one of
   2191      * {@link PackageManager#VERIFICATION_ALLOW} or
   2192      * {@link PackageManager#VERIFICATION_REJECT}.
   2193      *
   2194      * @param id pending package identifier as passed via the
   2195      *            {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra
   2196      * @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
   2197      *            or {@link PackageManager#VERIFICATION_REJECT}.
   2198      */
   2199     public abstract void verifyPendingInstall(int id, int verificationCode);
   2200 
   2201     /**
   2202      * Change the installer associated with a given package.  There are limitations
   2203      * on how the installer package can be changed; in particular:
   2204      * <ul>
   2205      * <li> A SecurityException will be thrown if <var>installerPackageName</var>
   2206      * is not signed with the same certificate as the calling application.
   2207      * <li> A SecurityException will be thrown if <var>targetPackage</var> already
   2208      * has an installer package, and that installer package is not signed with
   2209      * the same certificate as the calling application.
   2210      * </ul>
   2211      *
   2212      * @param targetPackage The installed package whose installer will be changed.
   2213      * @param installerPackageName The package name of the new installer.  May be
   2214      * null to clear the association.
   2215      */
   2216     public abstract void setInstallerPackageName(String targetPackage,
   2217             String installerPackageName);
   2218 
   2219     /**
   2220      * Attempts to delete a package.  Since this may take a little while, the result will
   2221      * be posted back to the given observer.  A deletion will fail if the calling context
   2222      * lacks the {@link android.Manifest.permission#DELETE_PACKAGES} permission, if the
   2223      * named package cannot be found, or if the named package is a "system package".
   2224      * (TODO: include pointer to documentation on "system packages")
   2225      *
   2226      * @param packageName The name of the package to delete
   2227      * @param observer An observer callback to get notified when the package deletion is
   2228      * complete. {@link android.content.pm.IPackageDeleteObserver#packageDeleted(boolean)} will be
   2229      * called when that happens.  observer may be null to indicate that no callback is desired.
   2230      * @param flags - possible values: {@link #DONT_DELETE_DATA}
   2231      *
   2232      * @hide
   2233      */
   2234     public abstract void deletePackage(
   2235             String packageName, IPackageDeleteObserver observer, int flags);
   2236 
   2237     /**
   2238      * Retrieve the package name of the application that installed a package. This identifies
   2239      * which market the package came from.
   2240      *
   2241      * @param packageName The name of the package to query
   2242      */
   2243     public abstract String getInstallerPackageName(String packageName);
   2244 
   2245     /**
   2246      * Attempts to clear the user data directory of an application.
   2247      * Since this may take a little while, the result will
   2248      * be posted back to the given observer.  A deletion will fail if the
   2249      * named package cannot be found, or if the named package is a "system package".
   2250      *
   2251      * @param packageName The name of the package
   2252      * @param observer An observer callback to get notified when the operation is finished
   2253      * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
   2254      * will be called when that happens.  observer may be null to indicate that
   2255      * no callback is desired.
   2256      *
   2257      * @hide
   2258      */
   2259     public abstract void clearApplicationUserData(String packageName,
   2260             IPackageDataObserver observer);
   2261     /**
   2262      * Attempts to delete the cache files associated with an application.
   2263      * Since this may take a little while, the result will
   2264      * be posted back to the given observer.  A deletion will fail if the calling context
   2265      * lacks the {@link android.Manifest.permission#DELETE_CACHE_FILES} permission, if the
   2266      * named package cannot be found, or if the named package is a "system package".
   2267      *
   2268      * @param packageName The name of the package to delete
   2269      * @param observer An observer callback to get notified when the cache file deletion
   2270      * is complete.
   2271      * {@link android.content.pm.IPackageDataObserver#onRemoveCompleted(String, boolean)}
   2272      * will be called when that happens.  observer may be null to indicate that
   2273      * no callback is desired.
   2274      *
   2275      * @hide
   2276      */
   2277     public abstract void deleteApplicationCacheFiles(String packageName,
   2278             IPackageDataObserver observer);
   2279 
   2280     /**
   2281      * Free storage by deleting LRU sorted list of cache files across
   2282      * all applications. If the currently available free storage
   2283      * on the device is greater than or equal to the requested
   2284      * free storage, no cache files are cleared. If the currently
   2285      * available storage on the device is less than the requested
   2286      * free storage, some or all of the cache files across
   2287      * all applications are deleted (based on last accessed time)
   2288      * to increase the free storage space on the device to
   2289      * the requested value. There is no guarantee that clearing all
   2290      * the cache files from all applications will clear up
   2291      * enough storage to achieve the desired value.
   2292      * @param freeStorageSize The number of bytes of storage to be
   2293      * freed by the system. Say if freeStorageSize is XX,
   2294      * and the current free storage is YY,
   2295      * if XX is less than YY, just return. if not free XX-YY number
   2296      * of bytes if possible.
   2297      * @param observer call back used to notify when
   2298      * the operation is completed
   2299      *
   2300      * @hide
   2301      */
   2302     public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
   2303 
   2304     /**
   2305      * Free storage by deleting LRU sorted list of cache files across
   2306      * all applications. If the currently available free storage
   2307      * on the device is greater than or equal to the requested
   2308      * free storage, no cache files are cleared. If the currently
   2309      * available storage on the device is less than the requested
   2310      * free storage, some or all of the cache files across
   2311      * all applications are deleted (based on last accessed time)
   2312      * to increase the free storage space on the device to
   2313      * the requested value. There is no guarantee that clearing all
   2314      * the cache files from all applications will clear up
   2315      * enough storage to achieve the desired value.
   2316      * @param freeStorageSize The number of bytes of storage to be
   2317      * freed by the system. Say if freeStorageSize is XX,
   2318      * and the current free storage is YY,
   2319      * if XX is less than YY, just return. if not free XX-YY number
   2320      * of bytes if possible.
   2321      * @param pi IntentSender call back used to
   2322      * notify when the operation is completed.May be null
   2323      * to indicate that no call back is desired.
   2324      *
   2325      * @hide
   2326      */
   2327     public abstract void freeStorage(long freeStorageSize, IntentSender pi);
   2328 
   2329     /**
   2330      * Retrieve the size information for a package.
   2331      * Since this may take a little while, the result will
   2332      * be posted back to the given observer.  The calling context
   2333      * should have the {@link android.Manifest.permission#GET_PACKAGE_SIZE} permission.
   2334      *
   2335      * @param packageName The name of the package whose size information is to be retrieved
   2336      * @param observer An observer callback to get notified when the operation
   2337      * is complete.
   2338      * {@link android.content.pm.IPackageStatsObserver#onGetStatsCompleted(PackageStats, boolean)}
   2339      * The observer's callback is invoked with a PackageStats object(containing the
   2340      * code, data and cache sizes of the package) and a boolean value representing
   2341      * the status of the operation. observer may be null to indicate that
   2342      * no callback is desired.
   2343      *
   2344      * @hide
   2345      */
   2346     public abstract void getPackageSizeInfo(String packageName,
   2347             IPackageStatsObserver observer);
   2348 
   2349     /**
   2350      * @deprecated This function no longer does anything; it was an old
   2351      * approach to managing preferred activities, which has been superceeded
   2352      * (and conflicts with) the modern activity-based preferences.
   2353      */
   2354     @Deprecated
   2355     public abstract void addPackageToPreferred(String packageName);
   2356 
   2357     /**
   2358      * @deprecated This function no longer does anything; it was an old
   2359      * approach to managing preferred activities, which has been superceeded
   2360      * (and conflicts with) the modern activity-based preferences.
   2361      */
   2362     @Deprecated
   2363     public abstract void removePackageFromPreferred(String packageName);
   2364 
   2365     /**
   2366      * Retrieve the list of all currently configured preferred packages.  The
   2367      * first package on the list is the most preferred, the last is the
   2368      * least preferred.
   2369      *
   2370      * @param flags Additional option flags. Use any combination of
   2371      * {@link #GET_ACTIVITIES},
   2372      * {@link #GET_GIDS},
   2373      * {@link #GET_CONFIGURATIONS},
   2374      * {@link #GET_INSTRUMENTATION},
   2375      * {@link #GET_PERMISSIONS},
   2376      * {@link #GET_PROVIDERS},
   2377      * {@link #GET_RECEIVERS},
   2378      * {@link #GET_SERVICES},
   2379      * {@link #GET_SIGNATURES}, to modify the data returned.
   2380      *
   2381      * @return Returns a list of PackageInfo objects describing each
   2382      * preferred application, in order of preference.
   2383      *
   2384      * @see #GET_ACTIVITIES
   2385      * @see #GET_GIDS
   2386      * @see #GET_CONFIGURATIONS
   2387      * @see #GET_INSTRUMENTATION
   2388      * @see #GET_PERMISSIONS
   2389      * @see #GET_PROVIDERS
   2390      * @see #GET_RECEIVERS
   2391      * @see #GET_SERVICES
   2392      * @see #GET_SIGNATURES
   2393      */
   2394     public abstract List<PackageInfo> getPreferredPackages(int flags);
   2395 
   2396     /**
   2397      * @deprecated This is a protected API that should not have been available
   2398      * to third party applications.  It is the platform's responsibility for
   2399      * assigning preferred activities and this can not be directly modified.
   2400      *
   2401      * Add a new preferred activity mapping to the system.  This will be used
   2402      * to automatically select the given activity component when
   2403      * {@link Context#startActivity(Intent) Context.startActivity()} finds
   2404      * multiple matching activities and also matches the given filter.
   2405      *
   2406      * @param filter The set of intents under which this activity will be
   2407      * made preferred.
   2408      * @param match The IntentFilter match category that this preference
   2409      * applies to.
   2410      * @param set The set of activities that the user was picking from when
   2411      * this preference was made.
   2412      * @param activity The component name of the activity that is to be
   2413      * preferred.
   2414      */
   2415     @Deprecated
   2416     public abstract void addPreferredActivity(IntentFilter filter, int match,
   2417             ComponentName[] set, ComponentName activity);
   2418 
   2419     /**
   2420      * @deprecated This is a protected API that should not have been available
   2421      * to third party applications.  It is the platform's responsibility for
   2422      * assigning preferred activities and this can not be directly modified.
   2423      *
   2424      * Replaces an existing preferred activity mapping to the system, and if that were not present
   2425      * adds a new preferred activity.  This will be used
   2426      * to automatically select the given activity component when
   2427      * {@link Context#startActivity(Intent) Context.startActivity()} finds
   2428      * multiple matching activities and also matches the given filter.
   2429      *
   2430      * @param filter The set of intents under which this activity will be
   2431      * made preferred.
   2432      * @param match The IntentFilter match category that this preference
   2433      * applies to.
   2434      * @param set The set of activities that the user was picking from when
   2435      * this preference was made.
   2436      * @param activity The component name of the activity that is to be
   2437      * preferred.
   2438      * @hide
   2439      */
   2440     @Deprecated
   2441     public abstract void replacePreferredActivity(IntentFilter filter, int match,
   2442             ComponentName[] set, ComponentName activity);
   2443 
   2444     /**
   2445      * Remove all preferred activity mappings, previously added with
   2446      * {@link #addPreferredActivity}, from the
   2447      * system whose activities are implemented in the given package name.
   2448      * An application can only clear its own package(s).
   2449      *
   2450      * @param packageName The name of the package whose preferred activity
   2451      * mappings are to be removed.
   2452      */
   2453     public abstract void clearPackagePreferredActivities(String packageName);
   2454 
   2455     /**
   2456      * Retrieve all preferred activities, previously added with
   2457      * {@link #addPreferredActivity}, that are
   2458      * currently registered with the system.
   2459      *
   2460      * @param outFilters A list in which to place the filters of all of the
   2461      * preferred activities, or null for none.
   2462      * @param outActivities A list in which to place the component names of
   2463      * all of the preferred activities, or null for none.
   2464      * @param packageName An option package in which you would like to limit
   2465      * the list.  If null, all activities will be returned; if non-null, only
   2466      * those activities in the given package are returned.
   2467      *
   2468      * @return Returns the total number of registered preferred activities
   2469      * (the number of distinct IntentFilter records, not the number of unique
   2470      * activity components) that were found.
   2471      */
   2472     public abstract int getPreferredActivities(List<IntentFilter> outFilters,
   2473             List<ComponentName> outActivities, String packageName);
   2474 
   2475     /**
   2476      * Set the enabled setting for a package component (activity, receiver, service, provider).
   2477      * This setting will override any enabled state which may have been set by the component in its
   2478      * manifest.
   2479      *
   2480      * @param componentName The component to enable
   2481      * @param newState The new enabled state for the component.  The legal values for this state
   2482      *                 are:
   2483      *                   {@link #COMPONENT_ENABLED_STATE_ENABLED},
   2484      *                   {@link #COMPONENT_ENABLED_STATE_DISABLED}
   2485      *                   and
   2486      *                   {@link #COMPONENT_ENABLED_STATE_DEFAULT}
   2487      *                 The last one removes the setting, thereby restoring the component's state to
   2488      *                 whatever was set in it's manifest (or enabled, by default).
   2489      * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
   2490      */
   2491     public abstract void setComponentEnabledSetting(ComponentName componentName,
   2492             int newState, int flags);
   2493 
   2494 
   2495     /**
   2496      * Return the the enabled setting for a package component (activity,
   2497      * receiver, service, provider).  This returns the last value set by
   2498      * {@link #setComponentEnabledSetting(ComponentName, int, int)}; in most
   2499      * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
   2500      * the value originally specified in the manifest has not been modified.
   2501      *
   2502      * @param componentName The component to retrieve.
   2503      * @return Returns the current enabled state for the component.  May
   2504      * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
   2505      * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
   2506      * {@link #COMPONENT_ENABLED_STATE_DEFAULT}.  The last one means the
   2507      * component's enabled state is based on the original information in
   2508      * the manifest as found in {@link ComponentInfo}.
   2509      */
   2510     public abstract int getComponentEnabledSetting(ComponentName componentName);
   2511 
   2512     /**
   2513      * Set the enabled setting for an application
   2514      * This setting will override any enabled state which may have been set by the application in
   2515      * its manifest.  It also overrides the enabled state set in the manifest for any of the
   2516      * application's components.  It does not override any enabled state set by
   2517      * {@link #setComponentEnabledSetting} for any of the application's components.
   2518      *
   2519      * @param packageName The package name of the application to enable
   2520      * @param newState The new enabled state for the component.  The legal values for this state
   2521      *                 are:
   2522      *                   {@link #COMPONENT_ENABLED_STATE_ENABLED},
   2523      *                   {@link #COMPONENT_ENABLED_STATE_DISABLED}
   2524      *                   and
   2525      *                   {@link #COMPONENT_ENABLED_STATE_DEFAULT}
   2526      *                 The last one removes the setting, thereby restoring the applications's state to
   2527      *                 whatever was set in its manifest (or enabled, by default).
   2528      * @param flags Optional behavior flags: {@link #DONT_KILL_APP} or 0.
   2529      */
   2530     public abstract void setApplicationEnabledSetting(String packageName,
   2531             int newState, int flags);
   2532 
   2533     /**
   2534      * Return the the enabled setting for an application.  This returns
   2535      * the last value set by
   2536      * {@link #setApplicationEnabledSetting(String, int, int)}; in most
   2537      * cases this value will be {@link #COMPONENT_ENABLED_STATE_DEFAULT} since
   2538      * the value originally specified in the manifest has not been modified.
   2539      *
   2540      * @param packageName The component to retrieve.
   2541      * @return Returns the current enabled state for the component.  May
   2542      * be one of {@link #COMPONENT_ENABLED_STATE_ENABLED},
   2543      * {@link #COMPONENT_ENABLED_STATE_DISABLED}, or
   2544      * {@link #COMPONENT_ENABLED_STATE_DEFAULT}.  The last one means the
   2545      * application's enabled state is based on the original information in
   2546      * the manifest as found in {@link ComponentInfo}.
   2547      * @throws IllegalArgumentException if the named package does not exist.
   2548      */
   2549     public abstract int getApplicationEnabledSetting(String packageName);
   2550 
   2551     /**
   2552      * Return whether the device has been booted into safe mode.
   2553      */
   2554     public abstract boolean isSafeMode();
   2555 
   2556     /**
   2557      * Attempts to move package resources from internal to external media or vice versa.
   2558      * Since this may take a little while, the result will
   2559      * be posted back to the given observer.   This call may fail if the calling context
   2560      * lacks the {@link android.Manifest.permission#MOVE_PACKAGE} permission, if the
   2561      * named package cannot be found, or if the named package is a "system package".
   2562      *
   2563      * @param packageName The name of the package to delete
   2564      * @param observer An observer callback to get notified when the package move is
   2565      * complete. {@link android.content.pm.IPackageMoveObserver#packageMoved(boolean)} will be
   2566      * called when that happens.  observer may be null to indicate that no callback is desired.
   2567      * @param flags To indicate install location {@link #MOVE_INTERNAL} or
   2568      * {@link #MOVE_EXTERNAL_MEDIA}
   2569      *
   2570      * @hide
   2571      */
   2572     public abstract void movePackage(
   2573             String packageName, IPackageMoveObserver observer, int flags);
   2574 
   2575     /**
   2576      * Creates a user with the specified name and options.
   2577      *
   2578      * @param name the user's name
   2579      * @param flags flags that identify the type of user and other properties.
   2580      * @see UserInfo
   2581      *
   2582      * @return the UserInfo object for the created user, or null if the user could not be created.
   2583      * @hide
   2584      */
   2585     public abstract UserInfo createUser(String name, int flags);
   2586 
   2587     /**
   2588      * @return the list of users that were created
   2589      * @hide
   2590      */
   2591     public abstract List<UserInfo> getUsers();
   2592 
   2593     /**
   2594      * @param id the ID of the user, where 0 is the primary user.
   2595      * @hide
   2596      */
   2597     public abstract boolean removeUser(int id);
   2598 
   2599     /**
   2600      * Updates the user's name.
   2601      *
   2602      * @param id the user's id
   2603      * @param name the new name for the user
   2604      * @hide
   2605      */
   2606     public abstract void updateUserName(int id, String name);
   2607 
   2608     /**
   2609      * Changes the user's properties specified by the flags.
   2610      *
   2611      * @param id the user's id
   2612      * @param flags the new flags for the user
   2613      * @hide
   2614      */
   2615     public abstract void updateUserFlags(int id, int flags);
   2616 
   2617     /**
   2618      * Checks to see if the user id is the same for the two uids, i.e., they belong to the same
   2619      * user.
   2620      * @hide
   2621      */
   2622     public static boolean isSameUser(int uid1, int uid2) {
   2623         return getUserId(uid1) == getUserId(uid2);
   2624     }
   2625 
   2626     /**
   2627      * Returns the user id for a given uid.
   2628      * @hide
   2629      */
   2630     public static int getUserId(int uid) {
   2631         return uid / PER_USER_RANGE;
   2632     }
   2633 
   2634     /**
   2635      * Returns the uid that is composed from the userId and the appId.
   2636      * @hide
   2637      */
   2638     public static int getUid(int userId, int appId) {
   2639         return userId * PER_USER_RANGE + (appId % PER_USER_RANGE);
   2640     }
   2641 
   2642     /**
   2643      * Returns the app id (or base uid) for a given uid, stripping out the user id from it.
   2644      * @hide
   2645      */
   2646     public static int getAppId(int uid) {
   2647         return uid % PER_USER_RANGE;
   2648     }
   2649 
   2650     /**
   2651      * Returns the device identity that verifiers can use to associate their
   2652      * scheme to a particular device. This should not be used by anything other
   2653      * than a package verifier.
   2654      *
   2655      * @return identity that uniquely identifies current device
   2656      * @hide
   2657      */
   2658     public abstract VerifierDeviceIdentity getVerifierDeviceIdentity();
   2659 }
   2660