/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

package com.skia;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;

public class VisualBenchActivity extends android.app.NativeActivity {
    static {
        System.loadLibrary("skia_android");
    }
    
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
    }
  
    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (!hasFocus) {
            return;
        }
        getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
            View.SYSTEM_UI_FLAG_FULLSCREEN |// hide status bar
            View.SYSTEM_UI_FLAG_IMMERSIVE);
        
        // Disable backlight to keep the system as cool as possible
        // TODO make this configurable
        Settings.System.putInt(getContentResolver(),
            Settings.System.SCREEN_BRIGHTNESS_MODE,
            Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
        
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.screenBrightness = 0; // 0f - no backlight
        getWindow().setAttributes(lp);
    }
}

@@ -627,173 +627,382 @@
     
-%7D%0A
   %0A    
-@Override%0A    public void onWindowFocusChanged(boolean hasFocus) %7B%0A        super.onWindowFocusCh
+    // Setup a bunch of window parameters.  We have to do this here to prevent our backend from%0A        // getting spurious term / init messages when we relayout%0A      %0A        // Layout fullscreen and keep screen on%0A        getWindow().addFlags(WindowM
 an
+a
 ge
-d(hasFocus);%0A        if (!hasFocus) %7B%0A            return
+r.LayoutParams.FLAG_FULLSCREEN %7C%0A                             WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
 ;%0A  
@@ -1003,25 +1003,24 @@
 N);%0A        
-%7D
 %0A        get
@@ -1070,32 +1070,34 @@
 ty(%0A            
+ 
+ 
 View.SYSTEM_UI_F
@@ -1138,32 +1138,34 @@
 bar%0A            
+  
 View.SYSTEM_UI_F
@@ -1195,24 +1195,26 @@
  status bar%0A
+  
             
@@ -1413,28 +1413,16 @@
 olver(),
-%0A           
  Setting
@@ -1454,16 +1454,57 @@
 S_MODE,%0A
+                                         
         

fix spurious init on VisualBench startup