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