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

Commit a3da4623 authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am 1fbb5da2: am 29bbd570: am 1f0f9fa9: Merge "Add null pointer check." into klp-dev

* commit '1fbb5da2':
  Fix a JNI local reference leak in JNIMediaPlayerListener::notify.
  Add null pointer check.
  Import translations. DO NOT MERGE
  Small DocumentsProvider doc improvements.
  Keyguard isn't visible if it hasn't been drawn.
  Enable fast camera transition when launched from navbar
  Reduce camera launch time by about 250ms.
  camera2: Remove prior repeating request when setting.
parents 1b967a1b 1fbb5da2
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -62,7 +62,8 @@ import java.io.FileNotFoundException;
 *            android:authorities="com.example.mycloudprovider"
 *            android:authorities="com.example.mycloudprovider"
 *            android:exported="true"
 *            android:exported="true"
 *            android:grantUriPermissions="true"
 *            android:grantUriPermissions="true"
 *            android:permission="android.permission.MANAGE_DOCUMENTS">
 *            android:permission="android.permission.MANAGE_DOCUMENTS"
 *            android:enabled="@bool/isAtLeastKitKat">
 *            <intent-filter>
 *            <intent-filter>
 *                <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
 *                <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
 *            </intent-filter>
 *            </intent-filter>
@@ -252,7 +253,8 @@ public abstract class DocumentsProvider extends ContentProvider {
     * {@link DocumentsContract#EXTRA_LOADING} on the Cursor to indicate that
     * {@link DocumentsContract#EXTRA_LOADING} on the Cursor to indicate that
     * you are still fetching additional data. Then, when the network data is
     * you are still fetching additional data. Then, when the network data is
     * available, you can send a change notification to trigger a requery and
     * available, you can send a change notification to trigger a requery and
     * return the complete contents.
     * return the complete contents. To return a Cursor with extras, you need to
     * extend and override {@link Cursor#getExtras()}.
     * <p>
     * <p>
     * To support change notifications, you must
     * To support change notifications, you must
     * {@link Cursor#setNotificationUri(ContentResolver, Uri)} with a relevant
     * {@link Cursor#setNotificationUri(ContentResolver, Uri)} with a relevant
@@ -362,7 +364,7 @@ public abstract class DocumentsProvider extends ContentProvider {
     * @param documentId the document to return.
     * @param documentId the document to return.
     * @param mode the mode to open with, such as 'r', 'w', or 'rw'.
     * @param mode the mode to open with, such as 'r', 'w', or 'rw'.
     * @param signal used by the caller to signal if the request should be
     * @param signal used by the caller to signal if the request should be
     *            cancelled.
     *            cancelled. May be null.
     * @see ParcelFileDescriptor#open(java.io.File, int, android.os.Handler,
     * @see ParcelFileDescriptor#open(java.io.File, int, android.os.Handler,
     *      OnCloseListener)
     *      OnCloseListener)
     * @see ParcelFileDescriptor#createReliablePipe()
     * @see ParcelFileDescriptor#createReliablePipe()
@@ -386,7 +388,7 @@ public abstract class DocumentsProvider extends ContentProvider {
     * @param documentId the document to return.
     * @param documentId the document to return.
     * @param sizeHint hint of the optimal thumbnail dimensions.
     * @param sizeHint hint of the optimal thumbnail dimensions.
     * @param signal used by the caller to signal if the request should be
     * @param signal used by the caller to signal if the request should be
     *            cancelled.
     *            cancelled. May be null.
     * @see Document#FLAG_SUPPORTS_THUMBNAIL
     * @see Document#FLAG_SUPPORTS_THUMBNAIL
     */
     */
    @SuppressWarnings("unused")
    @SuppressWarnings("unused")
+1 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,7 @@ void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2, const Parcel *o
            nativeParcel->setData(obj->data(), obj->dataSize());
            nativeParcel->setData(obj->data(), obj->dataSize());
            env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
            env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
                    msg, ext1, ext2, jParcel);
                    msg, ext1, ext2, jParcel);
            env->DeleteLocalRef(jParcel);
        }
        }
    } else {
    } else {
        env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
        env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
+8 −3
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.keyguard;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Color;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Handler;
@@ -41,7 +40,7 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
    private static final String TAG = CameraWidgetFrame.class.getSimpleName();
    private static final String TAG = CameraWidgetFrame.class.getSimpleName();
    private static final boolean DEBUG = KeyguardHostView.DEBUG;
    private static final boolean DEBUG = KeyguardHostView.DEBUG;
    private static final int WIDGET_ANIMATION_DURATION = 250; // ms
    private static final int WIDGET_ANIMATION_DURATION = 250; // ms
    private static final int WIDGET_WAIT_DURATION = 650; // ms
    private static final int WIDGET_WAIT_DURATION = 400; // ms
    private static final int RECOVERY_DELAY = 1000; // ms
    private static final int RECOVERY_DELAY = 1000; // ms


    interface Callbacks {
    interface Callbacks {
@@ -68,6 +67,7 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
    private FixedSizeFrameLayout mPreview;
    private FixedSizeFrameLayout mPreview;
    private View mFullscreenPreview;
    private View mFullscreenPreview;
    private View mFakeNavBar;
    private View mFakeNavBar;
    private boolean mUseFastTransition;


    private final Runnable mTransitionToCameraRunnable = new Runnable() {
    private final Runnable mTransitionToCameraRunnable = new Runnable() {
        @Override
        @Override
@@ -418,7 +418,8 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
    private void rescheduleTransitionToCamera() {
    private void rescheduleTransitionToCamera() {
        if (DEBUG) Log.d(TAG, "rescheduleTransitionToCamera at " + SystemClock.uptimeMillis());
        if (DEBUG) Log.d(TAG, "rescheduleTransitionToCamera at " + SystemClock.uptimeMillis());
        mHandler.removeCallbacks(mTransitionToCameraRunnable);
        mHandler.removeCallbacks(mTransitionToCameraRunnable);
        mHandler.postDelayed(mTransitionToCameraRunnable, WIDGET_WAIT_DURATION);
        final long duration = mUseFastTransition ? 0 : WIDGET_WAIT_DURATION;
        mHandler.postDelayed(mTransitionToCameraRunnable, duration);
    }
    }


    private void cancelTransitionToCamera() {
    private void cancelTransitionToCamera() {
@@ -513,4 +514,8 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli
        if (DEBUG) Log.d(TAG, "setInsets: " + insets);
        if (DEBUG) Log.d(TAG, "setInsets: " + insets);
        mInsets.set(insets);
        mInsets.set(insets);
    }
    }

    public void setUseFastTransition(boolean useFastTransition) {
        mUseFastTransition = useFastTransition;
    }
}
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -154,6 +154,10 @@ public class KeyguardViewStateManager implements
    public void onPageSwitching(View newPage, int newPageIndex) {
    public void onPageSwitching(View newPage, int newPageIndex) {
        if (mKeyguardWidgetPager != null && mChallengeLayout instanceof SlidingChallengeLayout) {
        if (mKeyguardWidgetPager != null && mChallengeLayout instanceof SlidingChallengeLayout) {
            boolean isCameraPage = newPage instanceof CameraWidgetFrame;
            boolean isCameraPage = newPage instanceof CameraWidgetFrame;
            if (isCameraPage) {
                CameraWidgetFrame camera = (CameraWidgetFrame) newPage;
                camera.setUseFastTransition(mKeyguardWidgetPager.isWarping());
            }
            SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout;
            SlidingChallengeLayout scl = (SlidingChallengeLayout) mChallengeLayout;
            scl.setChallengeInteractive(!isCameraPage);
            scl.setChallengeInteractive(!isCameraPage);
            final int currentFlags = mKeyguardWidgetPager.getSystemUiVisibility();
            final int currentFlags = mKeyguardWidgetPager.getSystemUiVisibility();
+6 −4
Original line number Original line Diff line number Diff line
@@ -82,13 +82,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc


    private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
    private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
    // The page is moved more than halfway, automatically move to the next page on touch up.
    // The page is moved more than halfway, automatically move to the next page on touch up.
    private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
    private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.5f;


    // The following constants need to be scaled based on density. The scaled versions will be
    // The following constants need to be scaled based on density. The scaled versions will be
    // assigned to the corresponding member variables below.
    // assigned to the corresponding member variables below.
    private static final int FLING_THRESHOLD_VELOCITY = 500;
    private static final int FLING_THRESHOLD_VELOCITY = 1500;
    private static final int MIN_SNAP_VELOCITY = 1500;
    private static final int MIN_SNAP_VELOCITY = 1500;
    private static final int MIN_FLING_VELOCITY = 250;
    private static final int MIN_FLING_VELOCITY = 500;


    // We are disabling touch interaction of the widget region for factory ROM.
    // We are disabling touch interaction of the widget region for factory ROM.
    private static final boolean DISABLE_TOUCH_INTERACTION = false;
    private static final boolean DISABLE_TOUCH_INTERACTION = false;
@@ -1938,10 +1938,12 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc


        if (isWarping()) {
        if (isWarping()) {
            dispatchOnPageEndWarp();
            dispatchOnPageEndWarp();
            notifyPageSwitching(whichPage);
            resetPageWarp();
            resetPageWarp();
        } else {
            notifyPageSwitching(whichPage);
        }
        }


        notifyPageSwitching(whichPage);
        View focusedChild = getFocusedChild();
        View focusedChild = getFocusedChild();
        if (focusedChild != null && whichPage != mCurrentPage &&
        if (focusedChild != null && whichPage != mCurrentPage &&
                focusedChild == getPageAt(mCurrentPage)) {
                focusedChild == getPageAt(mCurrentPage)) {
Loading