Home | History | Annotate | Download | only in pm
      1 /*
      2 **
      3 ** Copyright 2007, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 package android.content.pm;
     19 
     20 import android.content.ComponentName;
     21 import android.content.Intent;
     22 import android.content.IntentFilter;
     23 import android.content.pm.ActivityInfo;
     24 import android.content.pm.ApplicationInfo;
     25 import android.content.pm.FeatureInfo;
     26 import android.content.pm.IPackageInstallObserver;
     27 import android.content.pm.IPackageDeleteObserver;
     28 import android.content.pm.IPackageDataObserver;
     29 import android.content.pm.IPackageMoveObserver;
     30 import android.content.pm.IPackageStatsObserver;
     31 import android.content.pm.InstrumentationInfo;
     32 import android.content.pm.PackageInfo;
     33 import android.content.pm.ProviderInfo;
     34 import android.content.pm.PermissionGroupInfo;
     35 import android.content.pm.PermissionInfo;
     36 import android.content.pm.ResolveInfo;
     37 import android.content.pm.ServiceInfo;
     38 import android.net.Uri;
     39 import android.content.IntentSender;
     40 
     41 /**
     42  *  See {@link PackageManager} for documentation on most of the APIs
     43  *  here.
     44  *
     45  *  {@hide}
     46  */
     47 interface IPackageManager {
     48     PackageInfo getPackageInfo(String packageName, int flags);
     49     int getPackageUid(String packageName);
     50     int[] getPackageGids(String packageName);
     51 
     52     String[] currentToCanonicalPackageNames(in String[] names);
     53     String[] canonicalToCurrentPackageNames(in String[] names);
     54 
     55     PermissionInfo getPermissionInfo(String name, int flags);
     56 
     57     List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
     58 
     59     PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
     60 
     61     List<PermissionGroupInfo> getAllPermissionGroups(int flags);
     62 
     63     ApplicationInfo getApplicationInfo(String packageName, int flags);
     64 
     65     ActivityInfo getActivityInfo(in ComponentName className, int flags);
     66 
     67     ActivityInfo getReceiverInfo(in ComponentName className, int flags);
     68 
     69     ServiceInfo getServiceInfo(in ComponentName className, int flags);
     70 
     71     int checkPermission(String permName, String pkgName);
     72 
     73     int checkUidPermission(String permName, int uid);
     74 
     75     boolean addPermission(in PermissionInfo info);
     76 
     77     void removePermission(String name);
     78 
     79     boolean isProtectedBroadcast(String actionName);
     80 
     81     int checkSignatures(String pkg1, String pkg2);
     82 
     83     int checkUidSignatures(int uid1, int uid2);
     84 
     85     String[] getPackagesForUid(int uid);
     86 
     87     String getNameForUid(int uid);
     88 
     89     int getUidForSharedUser(String sharedUserName);
     90 
     91     ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
     92 
     93     List<ResolveInfo> queryIntentActivities(in Intent intent,
     94             String resolvedType, int flags);
     95 
     96     List<ResolveInfo> queryIntentActivityOptions(
     97             in ComponentName caller, in Intent[] specifics,
     98             in String[] specificTypes, in Intent intent,
     99             String resolvedType, int flags);
    100 
    101     List<ResolveInfo> queryIntentReceivers(in Intent intent,
    102             String resolvedType, int flags);
    103 
    104     ResolveInfo resolveService(in Intent intent,
    105             String resolvedType, int flags);
    106 
    107     List<ResolveInfo> queryIntentServices(in Intent intent,
    108             String resolvedType, int flags);
    109 
    110     List<PackageInfo> getInstalledPackages(int flags);
    111 
    112     List<ApplicationInfo> getInstalledApplications(int flags);
    113 
    114     /**
    115      * Retrieve all applications that are marked as persistent.
    116      *
    117      * @return A List&lt;applicationInfo> containing one entry for each persistent
    118      *         application.
    119      */
    120     List<ApplicationInfo> getPersistentApplications(int flags);
    121 
    122     ProviderInfo resolveContentProvider(String name, int flags);
    123 
    124     /**
    125      * Retrieve sync information for all content providers.
    126      *
    127      * @param outNames Filled in with a list of the root names of the content
    128      *                 providers that can sync.
    129      * @param outInfo Filled in with a list of the ProviderInfo for each
    130      *                name in 'outNames'.
    131      */
    132     void querySyncProviders(inout List<String> outNames,
    133             inout List<ProviderInfo> outInfo);
    134 
    135     List<ProviderInfo> queryContentProviders(
    136             String processName, int uid, int flags);
    137 
    138     InstrumentationInfo getInstrumentationInfo(
    139             in ComponentName className, int flags);
    140 
    141     List<InstrumentationInfo> queryInstrumentation(
    142             String targetPackage, int flags);
    143 
    144     /**
    145      * Install a package.
    146      *
    147      * @param packageURI The location of the package file to install.
    148      * @param observer a callback to use to notify when the package installation in finished.
    149      * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
    150      * {@link #REPLACE_EXISITING_PACKAGE}
    151      * @param installerPackageName Optional package name of the application that is performing the
    152      * installation. This identifies which market the package came from.
    153      */
    154     void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
    155             in String installerPackageName);
    156 
    157     void finishPackageInstall(int token);
    158 
    159     /**
    160      * Delete a package.
    161      *
    162      * @param packageName The fully qualified name of the package to delete.
    163      * @param observer a callback to use to notify when the package deletion in finished.
    164      * @param flags - possible values: {@link #DONT_DELETE_DATA}
    165      */
    166     void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags);
    167 
    168     String getInstallerPackageName(in String packageName);
    169 
    170     void addPackageToPreferred(String packageName);
    171 
    172     void removePackageFromPreferred(String packageName);
    173 
    174     List<PackageInfo> getPreferredPackages(int flags);
    175 
    176     void addPreferredActivity(in IntentFilter filter, int match,
    177             in ComponentName[] set, in ComponentName activity);
    178 
    179     void replacePreferredActivity(in IntentFilter filter, int match,
    180             in ComponentName[] set, in ComponentName activity);
    181 
    182     void clearPackagePreferredActivities(String packageName);
    183 
    184     int getPreferredActivities(out List<IntentFilter> outFilters,
    185             out List<ComponentName> outActivities, String packageName);
    186 
    187     /**
    188      * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
    189      */
    190     void setComponentEnabledSetting(in ComponentName componentName,
    191             in int newState, in int flags);
    192 
    193     /**
    194      * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
    195      */
    196     int getComponentEnabledSetting(in ComponentName componentName);
    197 
    198     /**
    199      * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
    200      */
    201     void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
    202 
    203     /**
    204      * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
    205      */
    206     int getApplicationEnabledSetting(in String packageName);
    207 
    208     /**
    209      * Free storage by deleting LRU sorted list of cache files across
    210      * all applications. If the currently available free storage
    211      * on the device is greater than or equal to the requested
    212      * free storage, no cache files are cleared. If the currently
    213      * available storage on the device is less than the requested
    214      * free storage, some or all of the cache files across
    215      * all applications are deleted (based on last accessed time)
    216      * to increase the free storage space on the device to
    217      * the requested value. There is no guarantee that clearing all
    218      * the cache files from all applications will clear up
    219      * enough storage to achieve the desired value.
    220      * @param freeStorageSize The number of bytes of storage to be
    221      * freed by the system. Say if freeStorageSize is XX,
    222      * and the current free storage is YY,
    223      * if XX is less than YY, just return. if not free XX-YY number
    224      * of bytes if possible.
    225      * @param observer call back used to notify when
    226      * the operation is completed
    227      */
    228      void freeStorageAndNotify(in long freeStorageSize,
    229              IPackageDataObserver observer);
    230 
    231     /**
    232      * Free storage by deleting LRU sorted list of cache files across
    233      * all applications. If the currently available free storage
    234      * on the device is greater than or equal to the requested
    235      * free storage, no cache files are cleared. If the currently
    236      * available storage on the device is less than the requested
    237      * free storage, some or all of the cache files across
    238      * all applications are deleted (based on last accessed time)
    239      * to increase the free storage space on the device to
    240      * the requested value. There is no guarantee that clearing all
    241      * the cache files from all applications will clear up
    242      * enough storage to achieve the desired value.
    243      * @param freeStorageSize The number of bytes of storage to be
    244      * freed by the system. Say if freeStorageSize is XX,
    245      * and the current free storage is YY,
    246      * if XX is less than YY, just return. if not free XX-YY number
    247      * of bytes if possible.
    248      * @param pi IntentSender call back used to
    249      * notify when the operation is completed.May be null
    250      * to indicate that no call back is desired.
    251      */
    252      void freeStorage(in long freeStorageSize,
    253              in IntentSender pi);
    254 
    255     /**
    256      * Delete all the cache files in an applications cache directory
    257      * @param packageName The package name of the application whose cache
    258      * files need to be deleted
    259      * @param observer a callback used to notify when the deletion is finished.
    260      */
    261     void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
    262 
    263     /**
    264      * Clear the user data directory of an application.
    265      * @param packageName The package name of the application whose cache
    266      * files need to be deleted
    267      * @param observer a callback used to notify when the operation is completed.
    268      */
    269     void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
    270 
    271    /**
    272      * Get package statistics including the code, data and cache size for
    273      * an already installed package
    274      * @param packageName The package name of the application
    275      * @param observer a callback to use to notify when the asynchronous
    276      * retrieval of information is complete.
    277      */
    278     void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
    279 
    280     /**
    281      * Get a list of shared libraries that are available on the
    282      * system.
    283      */
    284     String[] getSystemSharedLibraryNames();
    285 
    286     /**
    287      * Get a list of features that are available on the
    288      * system.
    289      */
    290     FeatureInfo[] getSystemAvailableFeatures();
    291 
    292     boolean hasSystemFeature(String name);
    293 
    294     void enterSafeMode();
    295     boolean isSafeMode();
    296     void systemReady();
    297     boolean hasSystemUidErrors();
    298 
    299     /**
    300      * Ask the package manager to perform dex-opt (if needed) on the given
    301      * package, if it already hasn't done mode.  Only does this if running
    302      * in the special development "no pre-dexopt" mode.
    303      */
    304     boolean performDexOpt(String packageName);
    305 
    306     /**
    307      * Update status of external media on the package manager to scan and
    308      * install packages installed on the external media. Like say the
    309      * MountService uses this to call into the package manager to update
    310      * status of sdcard.
    311      */
    312     void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
    313 
    314     String nextPackageToClean(String lastPackage);
    315 
    316     void movePackage(String packageName, IPackageMoveObserver observer, int flags);
    317 
    318     boolean addPermissionAsync(in PermissionInfo info);
    319 
    320     boolean setInstallLocation(int loc);
    321     int getInstallLocation();
    322 }
    323