summaryrefslogtreecommitdiffstats
path: root/test-runner/src
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-01-14 17:38:02 -0800
committerDianne Hackborn <hackbod@google.com>2013-01-16 12:11:01 -0800
commit35654b61e8fe7bc85afcb076ddbb590d51c5865f (patch)
tree0f42a90b4deaa0156d84df5d79b78cd6f2ac8807 /test-runner/src
parent8a8b047f2d28f6b2d728731a7e71eeaf16f89700 (diff)
downloadframeworks_base-35654b61e8fe7bc85afcb076ddbb590d51c5865f.zip
frameworks_base-35654b61e8fe7bc85afcb076ddbb590d51c5865f.tar.gz
frameworks_base-35654b61e8fe7bc85afcb076ddbb590d51c5865f.tar.bz2
More work on App Ops service.
Implemented reading and writing state to retain information across boots, API to retrieve state from it, improved location manager interaction to monitor both coarse and fine access and only note operations when location data is being delivered back to app (not when it is just registering to get the data at some time in the future). Also implement tracking of read/write ops on contacts and the call log. This involved tweaking the content provider protocol to pass over the name of the calling package, and some infrastructure in the ContentProvider transport to note incoming calls with the app ops service. The contacts provider and call log provider turn this on for themselves. This also implements some of the mechanics of being able to ignore incoming provider calls... all that is left are some new APIs for the real content provider implementation to be involved with providing the correct behavior for query() (return an empty cursor with the right columns) and insert() (need to figure out what URI to return). Change-Id: I36ebbcd63dee58264a480f3d3786891ca7cbdb4c
Diffstat (limited to 'test-runner/src')
-rw-r--r--test-runner/src/android/test/mock/MockContentProvider.java31
-rw-r--r--test-runner/src/android/test/mock/MockIContentProvider.java27
2 files changed, 33 insertions, 25 deletions
diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java
index 1e41416..373f24a 100644
--- a/test-runner/src/android/test/mock/MockContentProvider.java
+++ b/test-runner/src/android/test/mock/MockContentProvider.java
@@ -53,18 +53,20 @@ public class MockContentProvider extends ContentProvider {
*/
private class InversionIContentProvider implements IContentProvider {
@Override
- public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
+ public ContentProviderResult[] applyBatch(String callingPackage,
+ ArrayList<ContentProviderOperation> operations)
throws RemoteException, OperationApplicationException {
return MockContentProvider.this.applyBatch(operations);
}
@Override
- public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException {
+ public int bulkInsert(String callingPackage, Uri url, ContentValues[] initialValues)
+ throws RemoteException {
return MockContentProvider.this.bulkInsert(url, initialValues);
}
@Override
- public int delete(Uri url, String selection, String[] selectionArgs)
+ public int delete(String callingPackage, Uri url, String selection, String[] selectionArgs)
throws RemoteException {
return MockContentProvider.this.delete(url, selection, selectionArgs);
}
@@ -75,37 +77,39 @@ public class MockContentProvider extends ContentProvider {
}
@Override
- public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
+ public Uri insert(String callingPackage, Uri url, ContentValues initialValues)
+ throws RemoteException {
return MockContentProvider.this.insert(url, initialValues);
}
@Override
- public AssetFileDescriptor openAssetFile(Uri url, String mode) throws RemoteException,
- FileNotFoundException {
+ public AssetFileDescriptor openAssetFile(String callingPackage, Uri url, String mode)
+ throws RemoteException, FileNotFoundException {
return MockContentProvider.this.openAssetFile(url, mode);
}
@Override
- public ParcelFileDescriptor openFile(Uri url, String mode) throws RemoteException,
- FileNotFoundException {
+ public ParcelFileDescriptor openFile(String callingPackage, Uri url, String mode)
+ throws RemoteException, FileNotFoundException {
return MockContentProvider.this.openFile(url, mode);
}
@Override
- public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
+ public Cursor query(String callingPackage, Uri url, String[] projection, String selection,
+ String[] selectionArgs,
String sortOrder, ICancellationSignal cancellationSignal) throws RemoteException {
return MockContentProvider.this.query(url, projection, selection,
selectionArgs, sortOrder);
}
@Override
- public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
- throws RemoteException {
+ public int update(String callingPackage, Uri url, ContentValues values, String selection,
+ String[] selectionArgs) throws RemoteException {
return MockContentProvider.this.update(url, values, selection, selectionArgs);
}
@Override
- public Bundle call(String method, String request, Bundle args)
+ public Bundle call(String callingPackage, String method, String request, Bundle args)
throws RemoteException {
return MockContentProvider.this.call(method, request, args);
}
@@ -121,7 +125,8 @@ public class MockContentProvider extends ContentProvider {
}
@Override
- public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts)
+ public AssetFileDescriptor openTypedAssetFile(String callingPackage, Uri url,
+ String mimeType, Bundle opts)
throws RemoteException, FileNotFoundException {
return MockContentProvider.this.openTypedAssetFile(url, mimeType, opts);
}
diff --git a/test-runner/src/android/test/mock/MockIContentProvider.java b/test-runner/src/android/test/mock/MockIContentProvider.java
index 9fcfc22..2b4fce6 100644
--- a/test-runner/src/android/test/mock/MockIContentProvider.java
+++ b/test-runner/src/android/test/mock/MockIContentProvider.java
@@ -41,12 +41,12 @@ import java.util.ArrayList;
* @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
*/
public class MockIContentProvider implements IContentProvider {
- public int bulkInsert(Uri url, ContentValues[] initialValues) {
+ public int bulkInsert(String callingPackage, Uri url, ContentValues[] initialValues) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@SuppressWarnings("unused")
- public int delete(Uri url, String selection, String[] selectionArgs)
+ public int delete(String callingPackage, Uri url, String selection, String[] selectionArgs)
throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
@@ -56,23 +56,26 @@ public class MockIContentProvider implements IContentProvider {
}
@SuppressWarnings("unused")
- public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
+ public Uri insert(String callingPackage, Uri url, ContentValues initialValues)
+ throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public ParcelFileDescriptor openFile(Uri url, String mode) {
+ public ParcelFileDescriptor openFile(String callingPackage, Uri url, String mode) {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
+ public AssetFileDescriptor openAssetFile(String callingPackage, Uri uri, String mode) {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) {
+ public ContentProviderResult[] applyBatch(String callingPackage,
+ ArrayList<ContentProviderOperation> operations) {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
+ public Cursor query(String callingPackage, Uri url, String[] projection, String selection,
+ String[] selectionArgs,
String sortOrder, ICancellationSignal cancellationSignal) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@@ -82,12 +85,12 @@ public class MockIContentProvider implements IContentProvider {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
- throws RemoteException {
+ public int update(String callingPackage, Uri url, ContentValues values, String selection,
+ String[] selectionArgs) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public Bundle call(String method, String request, Bundle args)
+ public Bundle call(String callingPackage, String method, String request, Bundle args)
throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
@@ -100,8 +103,8 @@ public class MockIContentProvider implements IContentProvider {
throw new UnsupportedOperationException("unimplemented mock method");
}
- public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts)
- throws RemoteException, FileNotFoundException {
+ public AssetFileDescriptor openTypedAssetFile(String callingPackage, Uri url, String mimeType,
+ Bundle opts) throws RemoteException, FileNotFoundException {
throw new UnsupportedOperationException("unimplemented mock method");
}