title: Set lockscreen to "None" programmatically?
body: <p>I have the requirement to disable the lock screen and set the lock screen type to "None". My device is rooted (can run with SU permission) + can run as a system application with system permissions (under /system/app).</p>
  
  <p>I have tried a few things to no avail.</p>
  
  <p><strong>Try 1</strong></p>
  
  <p>This seems to be deprecated and not working.</p>
  
  <pre><code>KeyguardManager manager = (KeyguardManager) this.getSystemService(KEYGUARD_SERVICE);
  KeyguardLock lock = manager.newKeyguardLock("abc");
  lock.disableKeyguard(); 
  </code></pre>
  
  <p><strong>Try 2</strong></p>
  
  <p>This didn't work either.</p>
  
  <ol>
  <li>Mount system partition as writable</li>
  <li>Edit <code>/data/data/com.android.providers.settings/databases/settings.db</code></li>
  <li><p>Execute the following SQL.  </p>
  
  <p><code>INSERT OR REPLACE INTO system (name, value) VALUES ('lockscreen.disabled', '1');</code><br>
  <code>INSERT OR REPLACE INTO secure (name, value) VALUES ('lockscreen.disabled', '1');</code></p></li>
  </ol>
  
  <p><strong>Try 3</strong></p>
  
  <p>Rebooted the machine but still no luck.</p>
  
  <pre><code>android.provider.Settings.Secure.putLong(mContentResolver, Settings.Secure.LOCK_PATTERN_ENABLED, false);`
  android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.password_type", DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);`
  android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.password_type_alternate", DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
  android.provider.Settings.Secure.putLong(mContentResolver, "lockscreen.disabled", true);
  </code></pre>
  
  <p>Is there anything else that I can try?</p>
  
  <p>Please note that <strong>I do not want to disable the keyguard only when application is running.</strong></p>