HP slate 7 in restricted mode android app screen frozen when using View.SYSTEM_UI_FLAG_HIDE_NAVIGATION

77 Views Asked by At

I am developing an android app for HP Slate 7 on restricted mode(created a new user profile with limited access to resources) . The app need to be full screen hence i used View.SYSTEM_UI_FLAG_HIDE_NAVIGATION to hide the status and navigation bar, when i run the application the screen looks frozen and doesn't respond to touch(i cannot click buttons on the screen). when i swipe from down to up to see the navigation bar the screen looks like it comes to life and i can press the button. (This is not ideal for my app users as i dont want them to swipe the screen from down to up every time to access the screen as it is bad UX).

So my question is what would be so different between the restricted modes of HP slate and nexus, that my app works on nexus and doesn't work on HP . Please suggest if there is any way to solve this problem.

PS1 : i used onTouchEvent method as shown below to capture the touch event anywhere on the screen but the method was not invoked.

PS2: This happens only on restricted mode of HP slate 7 and doesn't happen on normal mode of HP slate 7, normal mode of nexus tablet or restricted mode of nexus tablet.

PS3 : I tested on four HP Slate 7 and two nexus tablets

PS4: after the swipe for navigation bar the app starts working hence i delete and create new user profile and install the apk again, if you try creating an app , please dont assume that app works after 1 try, as it goes back to not working mode, after recreating restricted user profile.

Edit :I would like to point out that my HP slate has kitkat and Nexus has lollipop

I found a question related to this topic, in which he was suggested to go fullscreen using "Theme.Holo.NoActionBar.Fullscreen" rather than immersive, if the api is less than or equal to 19(Kitkat) Immersive like feature in JB and ICS

Here is my code

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

    Button txtContinue;
    Button btnClickMe;
    TextView txtView;
    int n;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_short_form_test);
     txtContinue = (Button) findViewById(R.id.txtContinueTest);
     txtContinue.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent =  new Intent(MainActivity.this, 
              question1Activity.class);
            MainActivity.this.startActivity(intent);
            Log.i("########CLICKED#######","#####OnCreate#######");

         }
      });

     }


     @Override
     protected void onResume() {

        super.onResume();
        View decorView = getWindow().getDecorView();
        decorView
                .setSystemUiVisibility(
                         View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                         |  View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                         | View.SYSTEM_UI_FLAG_FULLSCREEN
                         | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                       );
       }

     @Override
     public boolean onTouchEvent(MotionEvent event) {

           Log.i("########Touched#######","#####TouchEvent########");
           return super.onTouchEvent(event);

     }


   }
0

There are 0 best solutions below