Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0de8c44a authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 4a207c4f: am 261208e0: Merge "Add API for obtaining changing configurations...

am 4a207c4f: am 261208e0: Merge "Add API for obtaining changing configurations bitmask from Theme" into mnc-dev

* commit '4a207c4f':
  Add API for obtaining changing configurations bitmask from Theme
parents 60e65f02 4a207c4f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9828,6 +9828,7 @@ package android.content.res {
  public final class Resources.Theme {
    method public void applyStyle(int, boolean);
    method public void dump(int, java.lang.String, java.lang.String);
    method public int getChangingConfigurations();
    method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
    method public android.content.res.Resources getResources();
    method public android.content.res.TypedArray obtainStyledAttributes(int[]);
+1 −0
Original line number Diff line number Diff line
@@ -10122,6 +10122,7 @@ package android.content.res {
  public final class Resources.Theme {
    method public void applyStyle(int, boolean);
    method public void dump(int, java.lang.String, java.lang.String);
    method public int getChangingConfigurations();
    method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
    method public android.content.res.Resources getResources();
    method public android.content.res.TypedArray obtainStyledAttributes(int[]);
+21 −3
Original line number Diff line number Diff line
@@ -570,8 +570,11 @@ public class ActivityInfo extends ComponentInfo
        Configuration.NATIVE_CONFIG_DENSITY,                // DENSITY
        Configuration.NATIVE_CONFIG_LAYOUTDIR,              // LAYOUT DIRECTION
    };
    /** @hide

    /**
     * Convert Java change bits to native.
     *
     * @hide
     */
    public static int activityInfoConfigToNative(int input) {
        int output = 0;
@@ -583,6 +586,21 @@ public class ActivityInfo extends ComponentInfo
        return output;
    }

    /**
     * Convert native change bits to Java.
     *
     * @hide
     */
    public static int activityInfoConfigNativeToJava(int input) {
        int output = 0;
        for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) {
            if ((input & CONFIG_NATIVE_BITS[i]) != 0) {
                output |= (1 << i);
            }
        }
        return output;
    }

    /**
     * @hide
     * Unfortunately some developers (OpenFeint I am looking at you) have
+1 −0
Original line number Diff line number Diff line
@@ -789,6 +789,7 @@ public final class AssetManager implements AutoCloseable {
                                                                TypedValue outValue,
                                                                boolean resolve);
    /*package*/ native static final void dumpTheme(long theme, int priority, String tag, String prefix);
    /*package*/ native static final int getThemeChangingConfigurations(long theme);

    private native final long openXmlAssetNative(int cookie, String fileName);

+13 −0
Original line number Diff line number Diff line
@@ -1730,6 +1730,19 @@ public class Resources {
            return Resources.this.getDrawable(id, this);
        }

        /**
         * Returns a bit mask of configuration changes that will impact this
         * theme (and thus require completely reloading it).
         *
         * @return a bit mask of configuration changes, as defined by
         *         {@link ActivityInfo}
         * @see ActivityInfo
         */
        public int getChangingConfigurations() {
            final int nativeChangingConfig = AssetManager.getThemeChangingConfigurations(mTheme);
            return ActivityInfo.activityInfoConfigNativeToJava(nativeChangingConfig);
        }

        /**
         * Print contents of this theme out to the log.  For debugging only.
         * 
Loading