/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.support.v17.leanback.app;

import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v17.leanback.test.R;
import android.view.Window;
import android.view.WindowManager;

/**
 * Activity containing {@link DetailsFragmentTest} used for testing.
 */
public class DetailsFragmentTestActivity extends Activity {
    private DetailsTestFragment mFragment;

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.details);
        mFragment = new DetailsTestFragment();

        if (savedInstanceState == null) {
            Intent intent = getIntent();
            if (intent.getExtras() != null) {
                Bundle arguments = new Bundle();
                arguments.putAll(intent.getExtras());
                mFragment.setArguments(arguments);
            }
            FragmentTransaction ft = getFragmentManager().beginTransaction();
            ft.replace(R.id.fragment_root, mFragment);
            ft.commit();
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        mFragment.setItem(new PhotoItem("Hello world", "Fake content goes here",
                R.drawable.spiderman));
    }

    public DetailsTestFragment getDetailsFragment() {
        return mFragment;
    }
}

@@ -850,49 +850,12 @@
 iew.
-Window;%0Aimport android.view.WindowManager
+View
 ;%0A%0A/
@@ -1224,111 +1224,83 @@
     
-requestWindowFeature(Window.FEATURE_NO_TITLE);%0A        getWindow().setFlags(WindowManager.LayoutParams.
+final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION %7C View.SYSTEM_UI_
 FLAG
@@ -1310,32 +1310,26 @@
 LLSCREEN
-,%0A      
+;%0A
         
   Window
@@ -1324,52 +1324,66 @@
     
-  
+get
 Window
-Manager.LayoutParams.FLAG_FULLSCREEN
+().getDecorView().setSystemUiVisibility(uiOptions
 );%0A 

fix flaky test