• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 android.systemui.cts;
18 
19 import android.annotation.MainThread;
20 import android.app.Activity;
21 import android.os.Bundle;
22 import android.view.View;
23 import android.view.ViewGroup.LayoutParams;
24 import android.view.WindowInsets;
25 
26 public class LightBarBaseActivity extends Activity {
27 
28     private View mContent;
29 
30     @Override
onCreate(Bundle bundle)31     protected void onCreate(Bundle bundle){
32         super.onCreate(bundle);
33         mContent = new View(this);
34         mContent.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
35                 LayoutParams.MATCH_PARENT));
36         setContentView(mContent);
37     }
38 
39     @MainThread
getRootWindowInsets()40     public WindowInsets getRootWindowInsets() {
41         return getWindow().getDecorView().getRootWindowInsets();
42     }
43 
getSystemUiVisibility()44     public int getSystemUiVisibility() {
45         return mContent.getWindowSystemUiVisibility();
46     }
47 
getTop()48     public int getTop() {
49         return mContent.getLocationOnScreen()[1];
50     }
51 
getBottom()52     public int getBottom() {
53         return mContent.getLocationOnScreen()[1] + mContent.getHeight();
54     }
55 
getWidth()56     public int getWidth() {
57         return mContent.getWidth();
58     }
59 }
60