CarPackageManager
  public
  
  final
  
  class
  CarPackageManager
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.car.content.pm.CarPackageManager | 
Provides car specific API related with package management.
Summary
| Constants | |
|---|---|
| String | MANIFEST_METADATA_TARGET_CAR_VERSIONThis constant is deprecated. Car version is no longer supported by the CarService. | 
| Public methods | |
|---|---|
| 
        
        
        
        
        
        CarVersion | 
      getTargetCarVersion()
      This method is deprecated. CarVersion is no longer supported by the CarService. | 
| 
        
        
        
        
        
        boolean | 
      isActivityDistractionOptimized(String packageName, String className)
      Returns whether an activity is distraction optimized, i.e, allowed in a restricted driving state. | 
| 
        
        
        
        
        
        boolean | 
      isPendingIntentDistractionOptimized(PendingIntent pendingIntent)
      Returns whether the given  | 
| 
        
        
        
        
        
        boolean | 
      isServiceDistractionOptimized(String packageName, String className)
      Check if given service is distraction optimized, i.e, allowed in a restricted driving state. | 
| Inherited methods | |
|---|---|
Constants
MANIFEST_METADATA_TARGET_CAR_VERSION
public static final String MANIFEST_METADATA_TARGET_CAR_VERSION
      This constant is deprecated.
    Car version is no longer supported by the CarService.
  
Manifest metadata used to specify the minimum major and minor Car API version an app is targeting.
Format is in the form major:minor or major.
 
For example, for Android 13, it would be:
 
 <meta-data android:name="android.car.targetCarVersion" android:value="33"/>
 
 
Or:
 
 <meta-data android:name="android.car.targetCarVersion" android:value="33:0"/>
 
 
And for Android 13 first update:
 
 <meta-data android:name="android.car.targetCarVersion" android:value="33:1"/>
 
Constant Value: "android.car.targetCarVersion"
Public methods
getTargetCarVersion
public CarVersion getTargetCarVersion ()
      This method is deprecated.
    CarVersion is no longer supported by the CarService.
  
Gets the Car API version targeted by app (as defined by
 MANIFEST_METADATA_TARGET_CAR_VERSION.
 
If the app manifest doesn't contain the MANIFEST_METADATA_TARGET_CAR_VERSION
 metadata attribute or if the attribute format is invalid, the returned CarVersion
 will be using the target platform
 version as major and 0 as minor instead.
| Returns | |
|---|---|
| CarVersion | targeted Car API version (as defined above) | 
isActivityDistractionOptimized
public boolean isActivityDistractionOptimized (String packageName, 
                String className)Returns whether an activity is distraction optimized, i.e, allowed in a restricted driving state.
| Parameters | |
|---|---|
| packageName | String: the activity'sPackageItemInfo.packageName. | 
| className | String: the activity'sPackageItemInfo.name. | 
| Returns | |
|---|---|
| boolean | true if the activity is distraction optimized, false if it isn't or if the value could not be determined. | 
isPendingIntentDistractionOptimized
public boolean isPendingIntentDistractionOptimized (PendingIntent pendingIntent)
Returns whether the given PendingIntent represents an activity that is distraction
 optimized, i.e, allowed in a restricted driving state.
| Parameters | |
|---|---|
| pendingIntent | PendingIntent: thePendingIntentto check. | 
| Returns | |
|---|---|
| boolean | true if the pending intent represents an activity that is distraction optimized, false if it isn't or if the value could not be determined. | 
isServiceDistractionOptimized
public boolean isServiceDistractionOptimized (String packageName, 
                String className)Check if given service is distraction optimized, i.e, allowed in a restricted driving state.
| Returns | |
|---|---|
| boolean | |
