diff options
6 files changed, 66 insertions, 32 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 739015fd2e65..8ad7810a13e8 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -2807,40 +2807,56 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate public void dispatchCreate() { mStateSaved = false; + mExecutingActions = true; moveToState(Fragment.CREATED, false); + mExecutingActions = false; } public void dispatchActivityCreated() { mStateSaved = false; + mExecutingActions = true; moveToState(Fragment.ACTIVITY_CREATED, false); + mExecutingActions = false; } public void dispatchStart() { mStateSaved = false; + mExecutingActions = true; moveToState(Fragment.STARTED, false); + mExecutingActions = false; } public void dispatchResume() { mStateSaved = false; + mExecutingActions = true; moveToState(Fragment.RESUMED, false); + mExecutingActions = false; } public void dispatchPause() { + mExecutingActions = true; moveToState(Fragment.STARTED, false); + mExecutingActions = false; } public void dispatchStop() { + mExecutingActions = true; moveToState(Fragment.STOPPED, false); + mExecutingActions = false; } public void dispatchDestroyView() { + mExecutingActions = true; moveToState(Fragment.CREATED, false); + mExecutingActions = false; } public void dispatchDestroy() { mDestroyed = true; execPendingActions(); + mExecutingActions = true; moveToState(Fragment.INITIALIZING, false); + mExecutingActions = false; mHost = null; mContainer = null; mParent = null; diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 9a4b45a7b0ab..2d47c7bcaa2f 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; +import android.app.admin.DevicePolicyManager; import android.app.Notification; import android.app.Notification.BigPictureStyle; import android.app.NotificationManager; @@ -46,6 +47,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.Process; +import android.os.UserHandle; import android.provider.MediaStore; import android.util.DisplayMetrics; import android.view.Display; @@ -866,6 +868,16 @@ class GlobalScreenshot { .setAutoCancel(true) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)); + final DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService( + Context.DEVICE_POLICY_SERVICE); + final Intent intent = dpm.createAdminSupportIntent( + DevicePolicyManager.POLICY_DISABLE_SCREEN_CAPTURE); + if (intent != null) { + final PendingIntent pendingIntent = PendingIntent.getActivityAsUser( + context, 0, intent, 0, null, UserHandle.CURRENT); + b.setContentIntent(pendingIntent); + } + SystemUI.overrideNotificationAppName(context, b); Notification n = new Notification.BigTextStyle(b) diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java index 9bc8e18a0fa8..2c7e9363da72 100644 --- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java @@ -638,6 +638,9 @@ public final class BridgeTypedArray extends TypedArray { return mContext.getProjectResourceValue(ResourceType.ID, idName, defValue); } } + else if (value.startsWith("@aapt:_aapt")) { + return mContext.getLayoutlibCallback().getResourceId(ResourceType.AAPT, value); + } // not a direct id valid reference. First check if it's an enum (this is a corner case // for attributes that have a reference|enum type), then fallback to resolve diff --git a/tools/layoutlib/bridge/src/android/content/res/Resources_Delegate.java b/tools/layoutlib/bridge/src/android/content/res/Resources_Delegate.java index 6e3a8e879306..c20ee12ee30c 100644 --- a/tools/layoutlib/bridge/src/android/content/res/Resources_Delegate.java +++ b/tools/layoutlib/bridge/src/android/content/res/Resources_Delegate.java @@ -131,9 +131,16 @@ public class Resources_Delegate { if (resourceInfo != null) { String attributeName = resourceInfo.getSecond(); RenderResources renderResources = resources.mContext.getRenderResources(); - return Pair.of(attributeName, platformResFlag_out[0] ? + ResourceValue value = platformResFlag_out[0] ? renderResources.getFrameworkResource(resourceInfo.getFirst(), attributeName) : - renderResources.getProjectResource(resourceInfo.getFirst(), attributeName)); + renderResources.getProjectResource(resourceInfo.getFirst(), attributeName); + + if (value == null) { + // Unable to resolve the attribute, just leave the unresolved value + value = new ResourceValue(resourceInfo.getFirst(), attributeName, attributeName, + platformResFlag_out[0]); + } + return Pair.of(attributeName, value); } return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/MockView.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/MockView.java index 91668af09f89..e10f20dfbbca 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/MockView.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/MockView.java @@ -100,7 +100,8 @@ public class MockView extends FrameLayout { mView.setText(text); } - private void setGravity(int gravity) { + @SuppressWarnings("WeakerAccess") // This method is used from Studio + public void setGravity(int gravity) { mView.setGravity(gravity); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index b3a2d3e27f88..f1e7b5177e13 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -286,18 +286,15 @@ public final class ResourceHelper { Density density = Density.MEDIUM; if (value instanceof DensityBasedResourceValue) { - density = - ((DensityBasedResourceValue)value).getResourceDensity(); + density = ((DensityBasedResourceValue) value).getResourceDensity(); } - if (lowerCaseValue.endsWith(NinePatch.EXTENSION_9PATCH)) { File file = new File(stringValue); if (file.isFile()) { try { - return getNinePatchDrawable( - new FileInputStream(file), density, value.isFramework(), - stringValue, context); + return getNinePatchDrawable(new FileInputStream(file), density, + value.isFramework(), stringValue, context); } catch (IOException e) { // failed to read the file, we'll return null below. Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ, @@ -306,30 +303,28 @@ public final class ResourceHelper { } return null; - } else if (lowerCaseValue.endsWith(".xml")) { + } else if (lowerCaseValue.endsWith(".xml") || stringValue.startsWith("@aapt:_aapt/")) { // create a block parser for the file - File f = new File(stringValue); - if (f.isFile()) { - try { - // let the framework inflate the Drawable from the XML file. - XmlPullParser parser = ParserFactory.create(f); - - BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser( - parser, context, value.isFramework()); - try { - return Drawable.createFromXml(context.getResources(), blockParser, theme); - } finally { - blockParser.ensurePopped(); + try { + XmlPullParser parser = context.getLayoutlibCallback().getParser(value); + if (parser == null) { + File drawableFile = new File(stringValue); + if (drawableFile.isFile()) { + parser = ParserFactory.create(drawableFile); } - } catch (Exception e) { - // this is an error and not warning since the file existence is checked before - // attempting to parse it. - Bridge.getLog().error(null, "Failed to parse file " + stringValue, - e, null /*data*/); } - } else { - Bridge.getLog().error(LayoutLog.TAG_BROKEN, - String.format("File %s does not exist (or is not a file)", stringValue), + + BridgeXmlBlockParser blockParser = + new BridgeXmlBlockParser(parser, context, value.isFramework()); + try { + return Drawable.createFromXml(context.getResources(), blockParser, theme); + } finally { + blockParser.ensurePopped(); + } + } catch (Exception e) { + // this is an error and not warning since the file existence is checked before + // attempting to parse it. + Bridge.getLog().error(null, "Failed to parse file " + stringValue, e, null /*data*/); } @@ -342,8 +337,8 @@ public final class ResourceHelper { value.isFramework() ? null : context.getProjectKey()); if (bitmap == null) { - bitmap = Bitmap_Delegate.createBitmap(bmpFile, false /*isMutable*/, - density); + bitmap = + Bitmap_Delegate.createBitmap(bmpFile, false /*isMutable*/, density); Bridge.setCachedBitmap(stringValue, bitmap, value.isFramework() ? null : context.getProjectKey()); } |