summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-07-06 16:35:25 -0700
committerRomain Guy <romainguy@android.com>2009-07-06 16:45:17 -0700
commit870e09fcd2dfdc12ac318962efd28b0420c562bb (patch)
treee96f3395c7176695e7007b21ec054c1e3d5a5e71 /core/java/android/app
parent453dd50e707aa3a4d24240935f3ff7ea0a08dc7a (diff)
downloadframeworks_base-870e09fcd2dfdc12ac318962efd28b0420c562bb.zip
frameworks_base-870e09fcd2dfdc12ac318962efd28b0420c562bb.tar.gz
frameworks_base-870e09fcd2dfdc12ac318962efd28b0420c562bb.tar.bz2
Fixes #1963229. Introduces Context#isRestricted().
A restricted Context is a special type of Context that prevents specific features from being used. For instance, android:onClick, used by View, can be dangerous when used from within apps widgets. By using a restricted Context to inflate apps widgets, widgets providers are prevented from using android:onClick.
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/ApplicationContext.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index 00b0593..61cd0fe 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -184,6 +184,7 @@ class ApplicationContext extends Context {
private StatusBarManager mStatusBarManager = null;
private TelephonyManager mTelephonyManager = null;
private ClipboardManager mClipboardManager = null;
+ private boolean mRestricted;
private final Object mSync = new Object();
@@ -1336,6 +1337,7 @@ class ApplicationContext extends Context {
mMainThread.getPackageInfo(packageName, flags);
if (pi != null) {
ApplicationContext c = new ApplicationContext();
+ c.mRestricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED;
c.init(pi, null, mMainThread);
if (c.mResources != null) {
return c;
@@ -1347,6 +1349,11 @@ class ApplicationContext extends Context {
"Application package " + packageName + " not found");
}
+ @Override
+ public boolean isRestricted() {
+ return mRestricted;
+ }
+
private File getDataDirFile() {
if (mPackageInfo != null) {
return mPackageInfo.getDataDirFile();