private void getMetricsWithSize(
      DisplayMetrics outMetrics,
      CompatibilityInfo compatInfo,
      Configuration configuration,
      int width,
      int height) {
    outMetrics.densityDpi = outMetrics.noncompatDensityDpi = logicalDensityDpi;
    outMetrics.density =
        outMetrics.noncompatDensity = logicalDensityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
    outMetrics.scaledDensity = outMetrics.noncompatScaledDensity = outMetrics.density;
    outMetrics.xdpi = outMetrics.noncompatXdpi = physicalXDpi;
    outMetrics.ydpi = outMetrics.noncompatYdpi = physicalYDpi;

    width =
        (configuration != null
                && configuration.screenWidthDp != Configuration.SCREEN_WIDTH_DP_UNDEFINED)
            ? (int) ((configuration.screenWidthDp * outMetrics.density) + 0.5f)
            : width;
    height =
        (configuration != null
                && configuration.screenHeightDp != Configuration.SCREEN_HEIGHT_DP_UNDEFINED)
            ? (int) ((configuration.screenHeightDp * outMetrics.density) + 0.5f)
            : height;

    outMetrics.noncompatWidthPixels = outMetrics.widthPixels = width;
    outMetrics.noncompatHeightPixels = outMetrics.heightPixels = height;

    if (!compatInfo.equals(CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)) {
      compatInfo.applyToDisplayMetrics(outMetrics);
    }
  }
コード例 #2
0
 public final void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   app.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
コード例 #3
0
 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   data.writeString(pkg);
   info.writeToParcel(data, 0);
   mRemote.transact(
       UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
 }
コード例 #4
0
 public final void scheduleCreateService(
     IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   data.writeStrongBinder(token);
   info.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
コード例 #5
0
 public final void bindApplication(
     String packageName,
     ApplicationInfo info,
     List<ProviderInfo> providers,
     ComponentName testName,
     String profileName,
     ParcelFileDescriptor profileFd,
     boolean autoStopProfiler,
     Bundle testArgs,
     IInstrumentationWatcher testWatcher,
     int debugMode,
     boolean restrictedBackupMode,
     boolean persistent,
     Configuration config,
     CompatibilityInfo compatInfo,
     Map<String, IBinder> services,
     Bundle coreSettings)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   data.writeString(packageName);
   info.writeToParcel(data, 0);
   data.writeTypedList(providers);
   if (testName == null) {
     data.writeInt(0);
   } else {
     data.writeInt(1);
     testName.writeToParcel(data, 0);
   }
   data.writeString(profileName);
   if (profileFd != null) {
     data.writeInt(1);
     profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
   } else {
     data.writeInt(0);
   }
   data.writeInt(autoStopProfiler ? 1 : 0);
   data.writeBundle(testArgs);
   data.writeStrongInterface(testWatcher);
   data.writeInt(debugMode);
   data.writeInt(restrictedBackupMode ? 1 : 0);
   data.writeInt(persistent ? 1 : 0);
   config.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   data.writeMap(services);
   data.writeBundle(coreSettings);
   mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
コード例 #6
0
 public final void scheduleReceiver(
     Intent intent,
     ActivityInfo info,
     CompatibilityInfo compatInfo,
     int resultCode,
     String resultData,
     Bundle map,
     boolean sync)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   intent.writeToParcel(data, 0);
   info.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   data.writeInt(resultCode);
   data.writeString(resultData);
   data.writeBundle(map);
   data.writeInt(sync ? 1 : 0);
   mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }
コード例 #7
0
 public final void scheduleLaunchActivity(
     Intent intent,
     IBinder token,
     int ident,
     ActivityInfo info,
     Configuration curConfig,
     CompatibilityInfo compatInfo,
     Bundle state,
     List<ResultInfo> pendingResults,
     List<Intent> pendingNewIntents,
     boolean notResumed,
     boolean isForward,
     String profileName,
     ParcelFileDescriptor profileFd,
     boolean autoStopProfiler)
     throws RemoteException {
   Parcel data = Parcel.obtain();
   data.writeInterfaceToken(IApplicationThread.descriptor);
   intent.writeToParcel(data, 0);
   data.writeStrongBinder(token);
   data.writeInt(ident);
   info.writeToParcel(data, 0);
   curConfig.writeToParcel(data, 0);
   compatInfo.writeToParcel(data, 0);
   data.writeBundle(state);
   data.writeTypedList(pendingResults);
   data.writeTypedList(pendingNewIntents);
   data.writeInt(notResumed ? 1 : 0);
   data.writeInt(isForward ? 1 : 0);
   data.writeString(profileName);
   if (profileFd != null) {
     data.writeInt(1);
     profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
   } else {
     data.writeInt(0);
   }
   data.writeInt(autoStopProfiler ? 1 : 0);
   mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
   data.recycle();
 }