• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 package com.skia;
9 
10 import android.os.Bundle;
11 import android.provider.Settings;
12 import android.view.View;
13 import android.view.WindowManager;
14 
15 public class VisualBenchActivity extends android.app.NativeActivity {
16     static {
17         System.loadLibrary("skia_android");
18     }
19 
20     @Override
onCreate(Bundle savedInstanceState)21     public void onCreate(Bundle savedInstanceState)
22     {
23         super.onCreate(savedInstanceState);
24 
25         // Setup a bunch of window parameters.  We have to do this here to prevent our backend from
26         // getting spurious term / init messages when we relayout
27 
28         // Layout fullscreen and keep screen on
29         getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN |
30                              WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
31 
32         getWindow().getDecorView().setSystemUiVisibility(
33               View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
34               View.SYSTEM_UI_FLAG_FULLSCREEN |// hide status bar
35               View.SYSTEM_UI_FLAG_IMMERSIVE);
36 
37         // Disable backlight to keep the system as cool as possible
38         // TODO make this configurable
39         Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
40                                                      Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
41 
42         WindowManager.LayoutParams lp = getWindow().getAttributes();
43         lp.screenBrightness = 0; // 0f - no backlight
44         getWindow().setAttributes(lp);
45     }
46 }
47