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

Commit 3b39f316 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Intercept touch events for launcher preview root view

This change prevents any accidental touches on any widgets in the
preview.

Test: Tapping on launcher preview in wallpaper app should never activate
a widget.
Bug: 191623924

Change-Id: I98d462eca699cf368dcd5894f15584f280932ccc
parent 68975572
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.launcher3.InsettableFrameLayout
<view class="com.android.launcher3.graphics.LauncherPreviewRenderer$LauncherPreviewLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
@@ -33,4 +33,4 @@
        android:id="@+id/hotseat"
        layout="@layout/hotseat" />

</com.android.launcher3.InsettableFrameLayout>
 No newline at end of file
</view>
 No newline at end of file
+13 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
@@ -534,4 +535,16 @@ public class LauncherPreviewRenderer extends ContextWrapper
            return false;
        }
    }

    /** Root layout for launcher preview that intercepts all touch events. */
    public static class LauncherPreviewLayout extends InsettableFrameLayout {
        public LauncherPreviewLayout(Context context, AttributeSet attrs) {
            super(context, attrs);
        }

        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            return true;
        }
    }
}