title: Disable Home Button in Android ICS (4.0)
body: <p>I am making a proprietary app for a company which will never release it to the Android Market (or Play Store I guess now) in Ice Cream Sandwich (Android 4.0).</p>
  
  <p>I need to disable the Home so the users cannot maliciously uninstall software or delete the data that the app captures.  This latest version is the first to be written in 4.0, the previous versions were written in 2.2 and 3.2.  </p>
  
  <p>For disabling the Home button in 2.2, I associated the app as a home replacement, so the button just reopened the app, but I can no longer use this method, as that somewhat prevents us from doing our updates to the app (we don't want to give the user the option of reselecting a Home default, as that would lead to data deletion.</p>
  
  <p>The code I have for disableing the Home button in 3.2 is:</p>
  
  <pre><code>@Override
  public void onAttachedToWindow() {
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
       super.onAttachedToWindow();
  }
  </code></pre>
  
  <p>and, under onCreate:</p>
  
  <pre><code>KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
  KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
  lock.disableKeyguard();
  </code></pre>
  
  <p>But when I run the same code that worked on my 3.2 tablet, it does not work on my 4.0 tablet.  </p>
  
  <p>I was wondering if there is a new API or method that 4.0 has that will accomplish the same effect as I currently have in my 3.2 implementation.</p>
  
  <p>Thanks for any help or direction.</p>
  
  <p>Adam</p>