1 /* 2 * Copyright (C) 2020 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 17 package com.android.systemui.wmshell; 18 19 import android.content.Context; 20 import android.content.res.Configuration; 21 import android.graphics.Insets; 22 import android.graphics.Rect; 23 import android.view.WindowManager; 24 25 import com.android.wm.shell.R; 26 import com.android.wm.shell.bubbles.BubblePositioner; 27 28 public class TestableBubblePositioner extends BubblePositioner { 29 private int mMaxBubbles; 30 private boolean mIsLargeScreen = false; 31 TestableBubblePositioner(Context context, WindowManager windowManager)32 public TestableBubblePositioner(Context context, 33 WindowManager windowManager) { 34 super(context, windowManager); 35 36 updateInternal(Configuration.ORIENTATION_PORTRAIT, 37 Insets.of(0, 0, 0, 0), 38 new Rect(0, 0, 500, 1000)); 39 mMaxBubbles = context.getResources().getInteger(R.integer.bubbles_max_rendered); 40 } 41 setMaxBubbles(int max)42 public void setMaxBubbles(int max) { 43 mMaxBubbles = max; 44 } 45 46 @Override getMaxBubbles()47 public int getMaxBubbles() { 48 return mMaxBubbles; 49 } 50 setIsLargeScreen(boolean isLargeScreen)51 public void setIsLargeScreen(boolean isLargeScreen) { 52 mIsLargeScreen = isLargeScreen; 53 } 54 55 @Override isLargeScreen()56 public boolean isLargeScreen() { 57 return mIsLargeScreen; 58 } 59 } 60