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

Commit 7b5b39d4 authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'gingerbread' into gingerbread-release

parents 6dd13207 bccfcd95
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import android.os.Parcelable;
 * @hide
 */
public class ObbInfo implements Parcelable {
    /** Flag noting that this OBB is an overlay patch for a base OBB. */
    public static final int OBB_OVERLAY = 1 << 0;

    /**
     * The name of the package to which the OBB file belongs.
     */
@@ -35,13 +38,26 @@ public class ObbInfo implements Parcelable {
     */
    public int version;

    /**
     * The flags relating to the OBB.
     */
    public int flags;

    public ObbInfo() {
    }

    public String toString() {
        return "ObbInfo{"
            + Integer.toHexString(System.identityHashCode(this))
            + " packageName=" + packageName + ",version=" + version + "}";
        StringBuilder sb = new StringBuilder();
        sb.append("ObbInfo{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" packageName=");
        sb.append(packageName);
        sb.append(",version=");
        sb.append(version);
        sb.append(",flags=");
        sb.append(flags);
        sb.append('}');
        return sb.toString();
    }

    public int describeContents() {
@@ -51,6 +67,7 @@ public class ObbInfo implements Parcelable {
    public void writeToParcel(Parcel dest, int parcelableFlags) {
        dest.writeString(packageName);
        dest.writeInt(version);
        dest.writeInt(flags);
    }

    public static final Parcelable.Creator<ObbInfo> CREATOR
@@ -67,5 +84,6 @@ public class ObbInfo implements Parcelable {
    private ObbInfo(Parcel source) {
        packageName = source.readString();
        version = source.readInt();
        flags = source.readInt();
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -304,6 +304,8 @@ public class StorageManager
     * file matches a package ID that is owned by the calling program's UID.
     * That is, shared UID applications can obtain access to any other
     * application's OBB that shares its UID.
     * <p>
     * STOPSHIP document more; discuss lack of guarantees of security
     * 
     * @param filename the path to the OBB file
     * @param key decryption key
@@ -328,6 +330,8 @@ public class StorageManager
     * file matches a package ID that is owned by the calling program's UID.
     * That is, shared UID applications can obtain access to any other
     * application's OBB that shares its UID.
     * <p>
     * STOPSHIP document more; discuss lack of guarantees of security
     * 
     * @param filename path to the OBB file
     * @param force whether to kill any programs using this in order to unmount
+23 −15
Original line number Diff line number Diff line
@@ -103,11 +103,11 @@ public abstract class WindowOrientationListener {
        }
    }

    public int getCurrentRotation() {
    public int getCurrentRotation(int lastRotation) {
        if (mEnabled) {
            return mSensorEventListener.getCurrentRotation();
            return mSensorEventListener.getCurrentRotation(lastRotation);
        }
        return -1;
        return lastRotation;
    }

    /**
@@ -153,9 +153,15 @@ public abstract class WindowOrientationListener {
        private static final int ROTATION_270 = 2;

        // Mapping our internal aliases into actual Surface rotation values
        private static final int[] SURFACE_ROTATIONS = new int[] {
        private static final int[] INTERNAL_TO_SURFACE_ROTATION = new int[] {
            Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_270};

        // Mapping Surface rotation values to internal aliases.
        // We have no constant for Surface.ROTATION_180.  That should never happen, but if it
        // does, we'll arbitrarily choose a mapping.
        private static final int[] SURFACE_TO_INTERNAL_ROTATION = new int[] {
            ROTATION_0, ROTATION_90, ROTATION_90, ROTATION_270};

        // Threshold ranges of orientation angle to transition into other orientation states.
        // The first list is for transitions from ROTATION_0, the next for ROTATION_90, etc.
        // ROTATE_TO defines the orientation each threshold range transitions to, and must be kept
@@ -243,8 +249,12 @@ public abstract class WindowOrientationListener {
            return (float) SAMPLING_PERIOD_MS / (timeConstantMs + SAMPLING_PERIOD_MS);
        }

        int getCurrentRotation() {
            return SURFACE_ROTATIONS[mRotation];
        int getCurrentRotation(int lastRotation) {
            if (mTiltDistrust > 0) {
                // we really don't know the current orientation, so trust what's currently displayed
                mRotation = SURFACE_TO_INTERNAL_ROTATION[lastRotation];
            }
            return INTERNAL_TO_SURFACE_ROTATION[mRotation];
        }

        private void calculateNewRotation(float orientation, float tiltAngle) {
@@ -267,7 +277,7 @@ public abstract class WindowOrientationListener {

            if (localLOGV) Log.i(TAG, " new rotation = " + rotation);
            mRotation = rotation;
            mOrientationListener.onOrientationChanged(getCurrentRotation());
            mOrientationListener.onOrientationChanged(INTERNAL_TO_SURFACE_ROTATION[mRotation]);
        }

        private float lowpassFilter(float newValue, float oldValue, float alpha) {
@@ -306,7 +316,8 @@ public abstract class WindowOrientationListener {
            mTiltAngle = lowpassFilter(newTiltAngle, mTiltAngle, alpha);

            float absoluteTilt = Math.abs(mTiltAngle);
            if (checkFullyTilted(absoluteTilt)) {
            checkFullyTilted(absoluteTilt);
            if (mTiltDistrust > 0) {
                return; // when fully tilted, ignore orientation entirely
            }

@@ -347,11 +358,9 @@ public abstract class WindowOrientationListener {
         * get un-tilted.
         *
         * @param absoluteTilt the absolute value of the current tilt angle
         * @return true if the phone is fully tilted
         */
        private boolean checkFullyTilted(float absoluteTilt) {
            boolean fullyTilted = absoluteTilt > MAX_TILT;
            if (fullyTilted) {
        private void checkFullyTilted(float absoluteTilt) {
            if (absoluteTilt > MAX_TILT) {
                if (mRotation == ROTATION_0) {
                    mOrientationAngle = 0;
                } else if (mRotation == ROTATION_90) {
@@ -366,7 +375,6 @@ public abstract class WindowOrientationListener {
            } else if (mTiltDistrust > 0) {
                mTiltDistrust--;
            }
            return fullyTilted;
        }

        /**
@@ -389,8 +397,8 @@ public abstract class WindowOrientationListener {
         */
        private void filterOrientation(float absoluteTilt, float orientationAngle) {
            float alpha = DEFAULT_LOWPASS_ALPHA;
            if (mTiltDistrust > 0 || mAccelerationDistrust > 1) {
                // when fully tilted, or under more than a transient acceleration, distrust heavily
            if (mAccelerationDistrust > 1) {
                // when under more than a transient acceleration, distrust heavily
                alpha = ACCELERATING_LOWPASS_ALPHA;
            } else if (absoluteTilt > PARTIAL_TILT || mAccelerationDistrust == 1) {
                // when tilted partway, or under transient acceleration, distrust lightly
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ static struct {

    jfieldID packageName;
    jfieldID version;
    jfieldID flags;
} gObbInfoClassInfo;

static jboolean android_content_res_ObbScanner_getObbInfo(JNIEnv* env, jobject clazz, jstring file,
@@ -85,6 +86,8 @@ int register_android_content_res_ObbScanner(JNIEnv* env)
            "packageName", "Ljava/lang/String;");
    GET_FIELD_ID(gObbInfoClassInfo.version, gObbInfoClassInfo.clazz,
            "version", "I");
    GET_FIELD_ID(gObbInfoClassInfo.flags, gObbInfoClassInfo.clazz,
            "flags", "I");

    return AndroidRuntime::registerNativeMethods(env, "android/content/res/ObbScanner", gMethods,
            NELEM(gMethods));
+17 −0
Original line number Diff line number Diff line
@@ -22,6 +22,21 @@

namespace android {

struct Size {
    int width;
    int height;

    Size() {
        width = 0;
        height = 0;
    }

    Size(int w, int h) {
        width = w;
        height = h;
    }
};

class CameraParameters
{
public:
@@ -43,12 +58,14 @@ public:

    void setPreviewSize(int width, int height);
    void getPreviewSize(int *width, int *height) const;
    void getSupportedPreviewSizes(Vector<Size> &sizes) const;
    void setPreviewFrameRate(int fps);
    int getPreviewFrameRate() const;
    void setPreviewFormat(const char *format);
    const char *getPreviewFormat() const;
    void setPictureSize(int width, int height);
    void getPictureSize(int *width, int *height) const;
    void getSupportedPictureSizes(Vector<Size> &sizes) const;
    void setPictureFormat(const char *format);
    const char *getPictureFormat() const;

Loading