1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.quickstep.fallback; 17 18 import android.content.Context; 19 import android.graphics.Insets; 20 import android.graphics.Rect; 21 import android.util.AttributeSet; 22 import android.view.WindowInsets; 23 24 import com.android.launcher3.util.TouchController; 25 import com.android.launcher3.views.BaseDragLayer; 26 import com.android.quickstep.RecentsActivity; 27 28 /** 29 * Minimal implementation of {@link BaseDragLayer} for Go's fallback recents activity. 30 */ 31 public final class GoRecentsActivityRootView extends BaseDragLayer<RecentsActivity> { GoRecentsActivityRootView(Context context, AttributeSet attrs)32 public GoRecentsActivityRootView(Context context, AttributeSet attrs) { 33 super(context, attrs, 1 /* alphaChannelCount */); 34 // Go leaves touch control to the view itself. 35 mControllers = new TouchController[0]; 36 setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 37 | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 38 | SYSTEM_UI_FLAG_LAYOUT_STABLE); 39 } 40 41 @Override setInsets(Rect insets)42 public void setInsets(Rect insets) { 43 if (insets.equals(mInsets)) { 44 return; 45 } 46 super.setInsets(insets); 47 } 48 49 @Override onApplyWindowInsets(WindowInsets insets)50 public WindowInsets onApplyWindowInsets(WindowInsets insets) { 51 Insets sysInsets = insets.getSystemWindowInsets(); 52 setInsets(new Rect(sysInsets.left, sysInsets.top, sysInsets.right, sysInsets.bottom)); 53 return insets.consumeSystemWindowInsets(); 54 } 55 } 56