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

Commit c3e1770f authored by Android Git Automerger's avatar Android Git Automerger
Browse files
parents fb774612 de8da848
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ import java.util.HashMap;
 */
public final class StrictMode {
    private static final String TAG = "StrictMode";
    private static final boolean LOG_V = false;
    private static final boolean LOG_V = Log.isLoggable(TAG, Log.VERBOSE);

    private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);

+13 −6
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ import com.android.internal.util.ArrayUtils;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.text.style.LeadingMarginSpan;
import android.text.style.LeadingMarginSpan.LeadingMarginSpan2;
import android.text.style.LineHeightSpan;
import android.text.style.MetricAffectingSpan;
import android.text.style.TabStopSpan;
import android.text.style.LeadingMarginSpan.LeadingMarginSpan2;

/**
 * StaticLayout is a Layout for text that will not be edited after it
@@ -36,9 +36,7 @@ import android.text.style.LeadingMarginSpan.LeadingMarginSpan2;
 * float, float, android.graphics.Paint)
 * Canvas.drawText()} directly.</p>
 */
public class
StaticLayout
extends Layout
public class StaticLayout extends Layout
{
    public StaticLayout(CharSequence source, TextPaint paint,
                        int width,
@@ -260,7 +258,7 @@ extends Layout
                    float before = w;

                    if (c == '\n') {
                        ;
                        // intentionally left empty
                    } else if (c == '\t') {
                        if (hasTab == false) {
                            hasTab = true;
@@ -837,6 +835,7 @@ extends Layout
    // rather than relying on member functions.
    // The logic mirrors that of Layout.getLineForVertical
    // FIXME: It may be faster to do a linear search for layouts without many lines.
    @Override
    public int getLineForVertical(int vertical) {
        int high = mLineCount;
        int low = -1;
@@ -857,38 +856,47 @@ extends Layout
        }
    }

    @Override
    public int getLineCount() {
        return mLineCount;
    }

    @Override
    public int getLineTop(int line) {
        return mLines[mColumns * line + TOP];
    }

    @Override
    public int getLineDescent(int line) {
        return mLines[mColumns * line + DESCENT];
    }

    @Override
    public int getLineStart(int line) {
        return mLines[mColumns * line + START] & START_MASK;
    }

    @Override
    public int getParagraphDirection(int line) {
        return mLines[mColumns * line + DIR] >> DIR_SHIFT;
    }

    @Override
    public boolean getLineContainsTab(int line) {
        return (mLines[mColumns * line + TAB] & TAB_MASK) != 0;
    }

    @Override
    public final Directions getLineDirections(int line) {
        return mLineDirections[line];
    }

    @Override
    public int getTopPadding() {
        return mTopPadding;
    }

    @Override
    public int getBottomPadding() {
        return mBottomPadding;
    }
@@ -935,7 +943,6 @@ extends Layout
    private Directions[] mLineDirections;

    private static final int START_MASK = 0x1FFFFFFF;
    private static final int DIR_MASK   = 0xC0000000;
    private static final int DIR_SHIFT  = 30;
    private static final int TAB_MASK   = 0x20000000;

+2 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "jni.h"
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
#include "private/android_filesystem_config.h"

#include "MtpClient.h"
#include "MtpDevice.h"
@@ -197,7 +198,7 @@ android_media_MtpClient_import_file(JNIEnv *env, jobject thiz,
    MtpDevice* device = client->getDevice(device_id);
    if (device) {
        const char *destPathStr = env->GetStringUTFChars(dest_path, NULL);
        bool result = device->readObject(object_id, destPathStr);
        bool result = device->readObject(object_id, destPathStr, AID_SDCARD_RW, 0664);
        env->ReleaseStringUTFChars(dest_path, destPathStr);
        return result;
    }
+7 −1
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) {
}

// reads the object's data and writes it to the specified file path
bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath) {
bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int group, int perm) {
    LOGD("readObject: %s", destPath);
    int fd = ::open(destPath, O_RDWR | O_CREAT | O_TRUNC);
    if (fd < 0) {
@@ -357,6 +357,12 @@ bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath) {
        return false;
    }

    fchown(fd, getuid(), group);
    // set permissions
    int mask = umask(0);
    fchmod(fd, perm);
    umask(mask);

    Mutex::Autolock autoLock(mMutex);
    bool result = false;

+4 −2
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ public:
    MtpDeviceInfo*          getDeviceInfo();
    MtpStorageIDList*       getStorageIDs();
    MtpStorageInfo*         getStorageInfo(MtpStorageID storageID);
    MtpObjectHandleList*    getObjectHandles(MtpStorageID storageID, MtpObjectFormat format, MtpObjectHandle parent);
    MtpObjectHandleList*    getObjectHandles(MtpStorageID storageID, MtpObjectFormat format,
                                    MtpObjectHandle parent);
    MtpObjectInfo*          getObjectInfo(MtpObjectHandle handle);
    void*                   getThumbnail(MtpObjectHandle handle, int& outLength);
    MtpObjectHandle         sendObjectInfo(MtpObjectInfo* info);
@@ -86,7 +87,8 @@ public:

    MtpProperty*            getDevicePropDesc(MtpDeviceProperty code);

    bool                   readObject(MtpObjectHandle handle, const char* destPath);
    bool                   readObject(MtpObjectHandle handle, const char* destPath, int group,
                                    int perm);

private:
    bool                    sendRequest(MtpOperationCode operation);
Loading