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

Commit 884f26bb authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Merge branch 'ub-launcher3-master' into launcher3merge2018-09-24

Test: will rely on presubmit
Change-Id: Id39959723c25e7e964ca85fd8b69692d554d157a
parents 1447f14c d65f5f7f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ buildscript {
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-beta05'
        classpath 'com.android.tools.build:gradle:3.2.0-rc03'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
    }
}
@@ -16,7 +16,7 @@ apply plugin: 'com.google.protobuf'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.0'
    buildToolsVersion '28.0.2'

    defaultConfig {
        minSdkVersion 21
+0 −74
Original line number Diff line number Diff line
@@ -2,80 +2,6 @@
  *;
}

-keep class com.android.launcher3.allapps.AllAppsBackgroundDrawable {
  public void setAlpha(int);
  public int getAlpha();
}

-keep class com.android.launcher3.BaseRecyclerViewFastScrollBar {
  public void setThumbWidth(int);
  public int getThumbWidth();
  public void setTrackWidth(int);
  public int getTrackWidth();
}

-keep class com.android.launcher3.BaseRecyclerViewFastScrollPopup {
  public void setAlpha(float);
  public float getAlpha();
}

-keep class com.android.launcher3.ButtonDropTarget {
  public int getTextColor();
}

-keep class com.android.launcher3.CellLayout {
  public float getBackgroundAlpha();
  public void setBackgroundAlpha(float);
}

-keep class com.android.launcher3.CellLayout$LayoutParams {
  public void setWidth(int);
  public int getWidth();
  public void setHeight(int);
  public int getHeight();
  public void setX(int);
  public int getX();
  public void setY(int);
  public int getY();
}

-keep class com.android.launcher3.views.BaseDragLayer$LayoutParams {
  public void setWidth(int);
  public int getWidth();
  public void setHeight(int);
  public int getHeight();
  public void setX(int);
  public int getX();
  public void setY(int);
  public int getY();
}

-keep class com.android.launcher3.FastBitmapDrawable {
  public void setDesaturation(float);
  public float getDesaturation();
  public void setBrightness(float);
  public float getBrightness();
}

-keep class com.android.launcher3.MemoryDumpActivity {
  *;
}

-keep class com.android.launcher3.PreloadIconDrawable {
  public float getAnimationProgress();
  public void setAnimationProgress(float);
}

-keep class com.android.launcher3.pageindicators.CaretDrawable {
  public float getCaretProgress();
  public void setCaretProgress(float);
}

-keep class com.android.launcher3.Workspace {
  public float getBackgroundAlpha();
  public void setBackgroundAlpha(float);
}

# Proguard will strip new callbacks in LauncherApps.Callback from
# WrappedCallback if compiled against an older SDK. Don't let this happen.
-keep class com.android.launcher3.compat.** {
+118 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.launcher3.uioverrides;

import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;

import android.os.RemoteException;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewConfiguration;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.touch.TouchEventTranslator;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.RecentsModel;
import com.android.systemui.shared.recents.ISystemUiProxy;

/**
 * TouchController for handling touch events that get sent to the StatusBar. Once the
 * Once the event delta y passes the touch slop, the events start getting forwarded.
 * All events are offset by initial Y value of the pointer.
 */
public class StatusBarTouchController implements TouchController {

    private static final String TAG = "StatusBarController";

    protected final Launcher mLauncher;
    protected final TouchEventTranslator mTranslator;
    private final float mTouchSlop;
    private ISystemUiProxy mSysUiProxy;

    /* If {@code false}, this controller should not handle the input {@link MotionEvent}.*/
    private boolean mCanIntercept;

    public StatusBarTouchController(Launcher l) {
        mLauncher = l;
        mTouchSlop = ViewConfiguration.get(l).getScaledTouchSlop();
        mTranslator = new TouchEventTranslator((MotionEvent ev)-> dispatchTouchEvent(ev));
    }

    private void dispatchTouchEvent(MotionEvent ev) {
        try {
            if (mSysUiProxy != null) {
                mSysUiProxy.onStatusBarMotionEvent(ev);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Remote exception on sysUiProxy.", e);
        }
    }

    @Override
    public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
        int action = ev.getActionMasked();
        if (action == ACTION_DOWN) {
            mCanIntercept = canInterceptTouch(ev);
            if (!mCanIntercept) {
                return false;
            }
            mTranslator.reset();
            mTranslator.setDownParameters(0, ev);
        } else if (ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
            // Check!! should only set it only when threshold is not entered.
            mTranslator.setDownParameters(ev.getActionIndex(), ev);
        }
        if (!mCanIntercept) {
            return false;
        }
        if (action == ACTION_MOVE) {
            float dy = ev.getY() - mTranslator.getDownY();
            if (dy > mTouchSlop) {
                mTranslator.dispatchDownEvents(ev);
                mTranslator.processMotionEvent(ev);
                return true;
            }
        }
        return false;
    }


    @Override
    public final boolean onControllerTouchEvent(MotionEvent ev) {
        mTranslator.processMotionEvent(ev);
        return true;
    }

    private boolean canInterceptTouch(MotionEvent ev) {
        if (!mLauncher.isInState(LauncherState.NORMAL) ||
                AbstractFloatingView.getTopOpenViewWithType(mLauncher,
                        AbstractFloatingView.TYPE_STATUS_BAR_SWIPE_DOWN_DISALLOW) != null) {
            return false;
        } else {
            // For NORMAL state, only listen if the event originated above the navbar height
            DeviceProfile dp = mLauncher.getDeviceProfile();
            if (ev.getY() > (mLauncher.getDragLayer().getHeight() - dp.getInsets().bottom)) {
                return false;
            }
        }
        mSysUiProxy = RecentsModel.INSTANCE.get(mLauncher).getSystemUiProxy();
        return mSysUiProxy != null;
    }
}
+17 −14
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
@@ -52,6 +53,7 @@ import com.android.systemui.shared.system.WindowManagerWrapper;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.zip.Deflater;

public class UiFactory {
@@ -59,24 +61,25 @@ public class UiFactory {
    public static TouchController[] createTouchControllers(Launcher launcher) {
        boolean swipeUpEnabled = OverviewInteractionState.INSTANCE.get(launcher)
                .isSwipeUpGestureEnabled();
        if (!swipeUpEnabled) {
            return new TouchController[] {
                    launcher.getDragController(),
                    new OverviewToAllAppsTouchController(launcher),
                    new LauncherTaskViewController(launcher)};
        ArrayList<TouchController> list = new ArrayList<>();
        list.add(launcher.getDragController());

        if (!swipeUpEnabled || launcher.getDeviceProfile().isVerticalBarLayout()) {
            list.add(new OverviewToAllAppsTouchController(launcher));
        }

        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return new TouchController[] {
                    launcher.getDragController(),
                    new OverviewToAllAppsTouchController(launcher),
                    new LandscapeEdgeSwipeController(launcher),
                    new LauncherTaskViewController(launcher)};
            list.add(new LandscapeEdgeSwipeController(launcher));
        } else {
            return new TouchController[] {
                    launcher.getDragController(),
                    new PortraitStatesTouchController(launcher),
                    new LauncherTaskViewController(launcher)};
            list.add(new PortraitStatesTouchController(launcher));
        }
        if (FeatureFlags.PULL_DOWN_STATUS_BAR && Utilities.IS_DEBUG_DEVICE
                && !launcher.getDeviceProfile().isMultiWindowMode
                && !launcher.getDeviceProfile().isVerticalBarLayout()) {
            list.add(new StatusBarTouchController(launcher));
        }
        list.add(new LauncherTaskViewController(launcher));
        return list.toArray(new TouchController[list.size()]);
    }

    public static void setOnTouchControllersChangedListener(Context context, Runnable listener) {
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ public class ClipAnimationHelper {
            updateStackBoundsToMultiWindowTaskSize(activity);
        } else {
            mSourceStackBounds.set(mHomeStackBounds);
            mSourceInsets.set(activity.getDeviceProfile().getInsets());
            mSourceInsets.set(ttv.getInsets());
        }

        TransformedRect targetRect = new TransformedRect();
Loading