// Signature format: 2.0
package android.test.mock {

  public class MockContext extends android.content.Context {
    method public int getDisplayId();
    method public void updateDisplay(int);
  }

  @Deprecated public class MockPackageManager extends android.content.pm.PackageManager {
    method @Deprecated public void addCrossProfileIntentFilter(android.content.IntentFilter, int, int, int);
    method @Deprecated public void clearCrossProfileIntentFilters(int);
    method @Deprecated public int getInstallReason(String, android.os.UserHandle);
    method @Deprecated public java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
    method @Deprecated public String[] getNamesForUids(int[]);
    method @Deprecated @NonNull public String getServicesSystemSharedLibraryPackageName();
    method @Deprecated @NonNull public String getSharedSystemSharedLibraryPackageName();
  }

}

