diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-08-14 16:45:30 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-08-14 16:51:38 -0700 |
commit | 756220bd1912535840388a6743830d2e59ad4964 (patch) | |
tree | ee97c666d4bb1f015fd3e89463af09c712ce47e4 /test-runner | |
parent | 863b19bc8fcfa436011781b67a237fcce3cb703a (diff) | |
download | frameworks_base-756220bd1912535840388a6743830d2e59ad4964.zip frameworks_base-756220bd1912535840388a6743830d2e59ad4964.tar.gz frameworks_base-756220bd1912535840388a6743830d2e59ad4964.tar.bz2 |
Add API to create new contexts with custom configurations.
This allows you to, say, make a Context whose configuration
is set to a different density than the actual density of the device.
The main API is Context.createConfigurationContext(). There is
also a new API on ContextThemeWrapper that allows you to apply
an override context before its resources are retrieved, which
addresses some feature requests from developers to be able to
customize the context their app is running in.
Change-Id: I88364986660088521e24b567e2fda22fb7042819
Diffstat (limited to 'test-runner')
-rw-r--r-- | test-runner/src/android/test/mock/MockContext.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java index 9acffa3..36f2c14 100644 --- a/test-runner/src/android/test/mock/MockContext.java +++ b/test-runner/src/android/test/mock/MockContext.java @@ -28,6 +28,7 @@ import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; +import android.content.res.Configuration; import android.content.res.Resources; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; @@ -477,6 +478,11 @@ public class MockContext extends Context { } @Override + public Context createConfigurationContext(Configuration overrideConfiguration) { + throw new UnsupportedOperationException(); + } + + @Override public boolean isRestricted() { throw new UnsupportedOperationException(); } |