summaryrefslogtreecommitdiff
path: root/test-mock
diff options
context:
space:
mode:
Diffstat (limited to 'test-mock')
-rw-r--r--test-mock/api/current.txt1
-rw-r--r--test-mock/api/system-current.txt2
-rw-r--r--test-mock/api/test-current.txt2
-rw-r--r--test-mock/src/android/test/mock/MockContentProvider.java30
-rw-r--r--test-mock/src/android/test/mock/MockContext.java18
-rw-r--r--test-mock/src/android/test/mock/MockIContentProvider.java23
6 files changed, 65 insertions, 11 deletions
diff --git a/test-mock/api/current.txt b/test-mock/api/current.txt
index c5169e502344..d1a68d4e9cb2 100644
--- a/test-mock/api/current.txt
+++ b/test-mock/api/current.txt
@@ -235,7 +235,6 @@ package android.test.mock {
method @Deprecated public android.content.Intent getLaunchIntentForPackage(String);
method @Deprecated public android.content.Intent getLeanbackLaunchIntentForPackage(String);
method @Deprecated public String getNameForUid(int);
- method @Deprecated public android.content.pm.PackageInfo getPackageArchiveInfo(String, int);
method @Deprecated public int[] getPackageGids(String) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public int[] getPackageGids(String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public android.content.pm.PackageInfo getPackageInfo(String, int) throws android.content.pm.PackageManager.NameNotFoundException;
diff --git a/test-mock/api/system-current.txt b/test-mock/api/system-current.txt
index f87785bfac18..9e022f0cb0ef 100644
--- a/test-mock/api/system-current.txt
+++ b/test-mock/api/system-current.txt
@@ -5,9 +5,7 @@ package android.test.mock {
method public android.content.Context createCredentialProtectedStorageContext();
method public java.io.File getPreloadsFileCache();
method public boolean isCredentialProtectedStorage();
- method public void sendBroadcast(android.content.Intent, String, android.os.Bundle);
method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, String, android.os.Bundle);
- method public void sendOrderedBroadcast(android.content.Intent, String, android.os.Bundle, android.content.BroadcastReceiver, android.os.Handler, int, String, android.os.Bundle);
}
@Deprecated public class MockPackageManager extends android.content.pm.PackageManager {
diff --git a/test-mock/api/test-current.txt b/test-mock/api/test-current.txt
index 531dd7c008fe..35f076fe3f00 100644
--- a/test-mock/api/test-current.txt
+++ b/test-mock/api/test-current.txt
@@ -6,6 +6,8 @@ package android.test.mock {
}
@Deprecated public class MockPackageManager extends android.content.pm.PackageManager {
+ method public void addCrossProfileIntentFilter(android.content.IntentFilter, int, int, int);
+ method public void clearCrossProfileIntentFilters(int);
method public int getInstallReason(String, android.os.UserHandle);
method public java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
method public String[] getNamesForUids(int[]);
diff --git a/test-mock/src/android/test/mock/MockContentProvider.java b/test-mock/src/android/test/mock/MockContentProvider.java
index 7be42f4f36f5..548dded9c47e 100644
--- a/test-mock/src/android/test/mock/MockContentProvider.java
+++ b/test-mock/src/android/test/mock/MockContentProvider.java
@@ -80,16 +80,22 @@ public class MockContentProvider extends ContentProvider {
}
@Override
- public String getType(Uri url) throws RemoteException {
+ public String getType(@NonNull AttributionSource attributionSource,
+ Uri url) throws RemoteException {
return MockContentProvider.this.getType(url);
}
@Override
- public void getTypeAsync(Uri uri, RemoteCallback callback) throws RemoteException {
+ public void getTypeAsync(@NonNull AttributionSource attributionSource,
+ Uri uri, RemoteCallback callback) throws RemoteException {
MockContentProvider.this.getTypeAsync(uri, callback);
}
@Override
+ public void getTypeAnonymousAsync(Uri uri, RemoteCallback callback) throws RemoteException {
+ MockContentProvider.this.getTypeAnonymousAsync(uri, callback);
+ }
+ @Override
public Uri insert(@NonNull AttributionSource attributionSource, Uri url,
ContentValues initialValues, Bundle extras) throws RemoteException {
return MockContentProvider.this.insert(url, initialValues, extras);
@@ -134,7 +140,8 @@ public class MockContentProvider extends ContentProvider {
}
@Override
- public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException {
+ public String[] getStreamTypes(AttributionSource attributionSource,
+ Uri url, String mimeTypeFilter) throws RemoteException {
return MockContentProvider.this.getStreamTypes(url, mimeTypeFilter);
}
@@ -247,6 +254,23 @@ public class MockContentProvider extends ContentProvider {
}
@Override
+ public String getTypeAnonymous(Uri uri) {
+ throw new UnsupportedOperationException("unimplemented mock method");
+ }
+
+ /**
+ * @hide
+ */
+ @SuppressWarnings("deprecation")
+ public void getTypeAnonymousAsync(Uri uri, RemoteCallback remoteCallback) {
+ AsyncTask.SERIAL_EXECUTOR.execute(() -> {
+ final Bundle bundle = new Bundle();
+ bundle.putString(ContentResolver.REMOTE_CALLBACK_RESULT, getTypeAnonymous(uri));
+ remoteCallback.sendResult(bundle);
+ });
+ }
+
+ @Override
public Uri insert(Uri uri, ContentValues values) {
throw new UnsupportedOperationException("unimplemented mock method");
}
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
index 49daad324bd1..f5f9d97787ae 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -839,6 +839,11 @@ public class MockContext extends Context {
}
@Override
+ public @NonNull Context createDeviceContext(int deviceId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public @NonNull Context createWindowContext(int type, Bundle options) {
throw new UnsupportedOperationException();
}
@@ -882,6 +887,17 @@ public class MockContext extends Context {
throw new UnsupportedOperationException();
}
+ /** @hide */
+ @Override
+ public void updateDeviceId(int deviceId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getDeviceId() {
+ throw new UnsupportedOperationException();
+ }
+
@Override
public File[] getExternalFilesDirs(String type) {
throw new UnsupportedOperationException();
@@ -951,7 +967,7 @@ public class MockContext extends Context {
/** {@hide} */
@Override
public IServiceConnection getServiceDispatcher(ServiceConnection conn, Handler handler,
- int flags) {
+ long flags) {
throw new UnsupportedOperationException();
}
diff --git a/test-mock/src/android/test/mock/MockIContentProvider.java b/test-mock/src/android/test/mock/MockIContentProvider.java
index b81c70704d79..23f8b98a704a 100644
--- a/test-mock/src/android/test/mock/MockIContentProvider.java
+++ b/test-mock/src/android/test/mock/MockIContentProvider.java
@@ -61,16 +61,30 @@ public class MockIContentProvider implements IContentProvider {
}
@Override
- public String getType(Uri url) {
+ public String getType(@NonNull AttributionSource attributionSource, Uri url) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
@SuppressWarnings("deprecation")
- public void getTypeAsync(Uri uri, RemoteCallback remoteCallback) {
+ public void getTypeAsync(@NonNull AttributionSource attributionSource,
+ Uri uri, RemoteCallback remoteCallback) {
AsyncTask.SERIAL_EXECUTOR.execute(() -> {
final Bundle bundle = new Bundle();
- bundle.putString(ContentResolver.REMOTE_CALLBACK_RESULT, getType(uri));
+ bundle.putString(ContentResolver.REMOTE_CALLBACK_RESULT, getType(attributionSource,
+ uri));
+ remoteCallback.sendResult(bundle);
+ });
+ }
+ public String getTypeAnonymous(Uri url) {
+ throw new UnsupportedOperationException("unimplemented mock method");
+ }
+ @Override
+ @SuppressWarnings("deprecation")
+ public void getTypeAnonymousAsync(Uri uri, RemoteCallback remoteCallback) {
+ AsyncTask.SERIAL_EXECUTOR.execute(() -> {
+ final Bundle bundle = new Bundle();
+ bundle.putString(ContentResolver.REMOTE_CALLBACK_RESULT, getTypeAnonymous(uri));
remoteCallback.sendResult(bundle);
});
}
@@ -130,7 +144,8 @@ public class MockIContentProvider implements IContentProvider {
}
@Override
- public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException {
+ public String[] getStreamTypes(@NonNull AttributionSource attributionSource,
+ Uri url, String mimeTypeFilter) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}