[
  {
    "path": "LockScreenApp/.classpath",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<classpath>\r\n\t<classpathentry kind=\"con\" path=\"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK\"/>\r\n\t<classpathentry exported=\"true\" kind=\"con\" path=\"com.android.ide.eclipse.adt.LIBRARIES\"/>\r\n\t<classpathentry kind=\"src\" path=\"src\"/>\r\n\t<classpathentry kind=\"src\" path=\"gen\"/>\r\n\t<classpathentry exported=\"true\" kind=\"con\" path=\"com.android.ide.eclipse.adt.DEPENDENCIES\"/>\r\n\t<classpathentry kind=\"output\" path=\"bin/classes\"/>\r\n</classpath>\r\n"
  },
  {
    "path": "LockScreenApp/.project",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<projectDescription>\r\n\t<name>LockScreenApp</name>\r\n\t<comment></comment>\r\n\t<projects>\r\n\t</projects>\r\n\t<buildSpec>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>org.eclipse.jdt.core.javabuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t\t<buildCommand>\r\n\t\t\t<name>com.android.ide.eclipse.adt.ApkBuilder</name>\r\n\t\t\t<arguments>\r\n\t\t\t</arguments>\r\n\t\t</buildCommand>\r\n\t</buildSpec>\r\n\t<natures>\r\n\t\t<nature>com.android.ide.eclipse.adt.AndroidNature</nature>\r\n\t\t<nature>org.eclipse.jdt.core.javanature</nature>\r\n\t</natures>\r\n</projectDescription>\r\n"
  },
  {
    "path": "LockScreenApp/.settings/org.eclipse.jdt.core.prefs",
    "content": "eclipse.preferences.version=1\r\norg.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r\norg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r\norg.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r\norg.eclipse.jdt.core.compiler.compliance=1.6\r\norg.eclipse.jdt.core.compiler.debug.lineNumber=generate\r\norg.eclipse.jdt.core.compiler.debug.localVariable=generate\r\norg.eclipse.jdt.core.compiler.debug.sourceFile=generate\r\norg.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r\norg.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r\norg.eclipse.jdt.core.compiler.source=1.6\r\n"
  },
  {
    "path": "LockScreenApp/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    package=\"com.mehuljoisar.lockscreen\"\r\n    android:versionCode=\"3\"\r\n    android:versionName=\"1.2\" >\r\n\r\n    <uses-sdk android:minSdkVersion=\"8\" />\r\n\r\n    <uses-permission android:name=\"android.permission.DISABLE_KEYGUARD\" />\r\n    <uses-permission android:name=\"android.permission.WAKE_LOCK\" />\r\n    <uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\" />\r\n    <uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />\r\n    <uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\" />\r\n\r\n    <application\r\n        android:icon=\"@drawable/ic_launcher\"\r\n        android:label=\"@string/app_name\" >\r\n        <activity\r\n            android:name=\"com.mehuljoisar.lockscreen.LockScreenActivity\"\r\n            android:excludeFromRecents=\"true\"\r\n            android:label=\"@string/app_name\"\r\n            android:launchMode=\"singleTask\"\r\n            android:screenOrientation=\"portrait\"\r\n            android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\" >\r\n            <intent-filter>\r\n                <action android:name=\"android.intent.action.MAIN\" />\r\n\r\n                <category android:name=\"android.intent.category.LAUNCHER\" />\r\n            </intent-filter>\r\n        </activity>\r\n\r\n        <service android:name=\".utils.LockscreenService\" >\r\n        </service>\r\n\r\n        <receiver\r\n            android:name=\".utils.LockscreenIntentReceiver\"\r\n            android:enabled=\"true\" >\r\n            <intent-filter>\r\n                <action android:name=\"android.intent.action.BOOT_COMPLETED\" />\r\n            </intent-filter>\r\n        </receiver>\r\n    </application>\r\n\r\n</manifest>"
  },
  {
    "path": "LockScreenApp/proguard.cfg",
    "content": "-optimizationpasses 5\n-dontusemixedcaseclassnames\n-dontskipnonpubliclibraryclasses\n-dontpreverify\n-verbose\n-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*\n\n-keep public class * extends android.app.Activity\n-keep public class * extends android.app.Application\n-keep public class * extends android.app.Service\n-keep public class * extends android.content.BroadcastReceiver\n-keep public class * extends android.content.ContentProvider\n-keep public class * extends android.app.backup.BackupAgentHelper\n-keep public class * extends android.preference.Preference\n-keep public class com.android.vending.licensing.ILicensingService\n\n-keepclasseswithmembernames class * {\n    native <methods>;\n}\n\n-keepclasseswithmembers class * {\n    public <init>(android.content.Context, android.util.AttributeSet);\n}\n\n-keepclasseswithmembers class * {\n    public <init>(android.content.Context, android.util.AttributeSet, int);\n}\n\n-keepclassmembers class * extends android.app.Activity {\n   public void *(android.view.View);\n}\n\n-keepclassmembers enum * {\n    public static **[] values();\n    public static ** valueOf(java.lang.String);\n}\n\n-keep class * implements android.os.Parcelable {\n  public static final android.os.Parcelable$Creator *;\n}\n"
  },
  {
    "path": "LockScreenApp/project.properties",
    "content": "# This file is automatically generated by Android Tools.\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n#\n# This file must be checked in Version Control Systems.\n#\n# To customize properties used by the Ant build system use,\n# \"ant.properties\", and override values to adapt the script to your\n# project structure.\n\n# Project target.\ntarget=Google Inc.:Google APIs:22\n"
  },
  {
    "path": "LockScreenApp/res/color/selector_txt_btn_unlock.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\r\n\r\n    <item android:state_pressed=\"true\" android:color=\"@color/white\"/>\r\n    <item android:color=\"@color/black\"/>\r\n\r\n</selector>"
  },
  {
    "path": "LockScreenApp/res/drawable/selector_bg_btn_unlock.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\r\n\r\n    <item android:drawable=\"@color/black\" android:state_pressed=\"true\"/>\r\n    <item android:drawable=\"@color/white\"/>\r\n\r\n</selector>"
  },
  {
    "path": "LockScreenApp/res/layout/activity_lockscreen.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:background=\"@color/yellow\"\r\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\r\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\r\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\r\n    android:paddingTop=\"@dimen/activity_vertical_margin\" >\r\n\r\n    <TextView\r\n        android:id=\"@+id/tvInstructions\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string/instructions\"\r\n        android:textAppearance=\"@android:style/TextAppearance.Medium\"\r\n        android:textColor=\"@color/black\" />\r\n\r\n    <Button\r\n        android:id=\"@+id/btnUnlock\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:padding=\"15dp\"\r\n        android:layout_below=\"@id/tvInstructions\"\r\n        android:layout_centerHorizontal=\"true\"\r\n        android:background=\"@drawable/selector_bg_btn_unlock\"\r\n        android:text=\"@string/unlock\"\r\n        android:textAppearance=\"@android:style/TextAppearance.Large\"\r\n        android:textColor=\"@color/selector_txt_btn_unlock\" />\r\n\r\n</RelativeLayout>"
  },
  {
    "path": "LockScreenApp/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n\r\n    <color name=\"yellow\">#F5DC49</color>\r\n    <color name=\"black\">#000000</color>\r\n    <color name=\"white\">#FFFFFF</color>\r\n    \r\n</resources>"
  },
  {
    "path": "LockScreenApp/res/values/dimens.xml",
    "content": "<resources>\r\n\r\n    <!-- Default screen margins, per the Android Design guidelines. -->\r\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\r\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\r\n\r\n</resources>\r\n"
  },
  {
    "path": "LockScreenApp/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n\r\n    <string name=\"app_name\">LockScreenApp</string>\r\n\r\n    <string name=\"instructions\">Click on UNLOCK button to unlock the screen</string>\r\n    <string name=\"unlock\">UNLOCK</string>\r\n    \r\n</resources>"
  },
  {
    "path": "LockScreenApp/res/values/style.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n\r\n    <style name=\"OverlayDialog\" parent=\"@android:style/Theme.Dialog\">\r\n        <item name=\"android:windowBackground\">@android:color/transparent</item>\r\n        <item name=\"android:windowFrame\">@null</item>\r\n        <item name=\"android:windowNoTitle\">true</item>\r\n        <item name=\"android:windowIsFloating\">true</item>\r\n        <item name=\"android:windowIsTranslucent\">false</item>\r\n        <item name=\"android:backgroundDimEnabled\">false</item>\r\n    </style>\r\n\r\n</resources>"
  },
  {
    "path": "LockScreenApp/res/values-w820dp/dimens.xml",
    "content": "<resources>\r\n\r\n    <!--\r\n         Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively).\r\n    -->\r\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\r\n\r\n</resources>\r\n"
  },
  {
    "path": "LockScreenApp/src/com/mehuljoisar/lockscreen/LockScreenActivity.java",
    "content": "package com.mehuljoisar.lockscreen;\n\nimport android.app.Activity;\nimport android.app.KeyguardManager;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.telephony.PhoneStateListener;\nimport android.telephony.TelephonyManager;\nimport android.util.Log;\nimport android.view.KeyEvent;\nimport android.view.View;\nimport android.view.WindowManager;\nimport android.view.WindowManager.LayoutParams;\nimport android.widget.Button;\n\nimport com.mehuljoisar.lockscreen.utils.LockscreenService;\nimport com.mehuljoisar.lockscreen.utils.LockscreenUtils;\n\npublic class LockScreenActivity extends Activity implements\n\t\tLockscreenUtils.OnLockStatusChangedListener {\n\n\t// User-interface\n\tprivate Button btnUnlock;\n\n\t// Member variables\n\tprivate LockscreenUtils mLockscreenUtils;\n\n\t// Set appropriate flags to make the screen appear over the keyguard\n\t@Override\n\tpublic void onAttachedToWindow() {\n\t\tthis.getWindow().setType(\n\t\t\t\tWindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);\n\t\tthis.getWindow().addFlags(\n\t\t\t\tWindowManager.LayoutParams.FLAG_FULLSCREEN\n\t\t\t\t\t\t| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED\n\t\t\t\t\t\t| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON\n\t\t\t\t\t\t| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD\n\t\t\t\t\t\t);\n\n\t\tsuper.onAttachedToWindow();\n\t}\n\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\n\t\tsetContentView(R.layout.activity_lockscreen);\n\n\t\tinit();\n\n\t\t// unlock screen in case of app get killed by system\n\t\tif (getIntent() != null && getIntent().hasExtra(\"kill\")\n\t\t\t\t&& getIntent().getExtras().getInt(\"kill\") == 1) {\n\t\t\tenableKeyguard();\n\t\t\tunlockHomeButton();\n\t\t} else {\n\n\t\t\ttry {\n\t\t\t\t// disable keyguard\n\t\t\t\tdisableKeyguard();\n\n\t\t\t\t// lock home button\n\t\t\t\tlockHomeButton();\n\n\t\t\t\t// start service for observing intents\n\t\t\t\tstartService(new Intent(this, LockscreenService.class));\n\n\t\t\t\t// listen the events get fired during the call\n\t\t\t\tStateListener phoneStateListener = new StateListener();\n\t\t\t\tTelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);\n\t\t\t\ttelephonyManager.listen(phoneStateListener,\n\t\t\t\t\t\tPhoneStateListener.LISTEN_CALL_STATE);\n\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\n\t\t}\n\t}\n\n\tprivate void init() {\n\t\tmLockscreenUtils = new LockscreenUtils();\n\t\tbtnUnlock = (Button) findViewById(R.id.btnUnlock);\n\t\tbtnUnlock.setOnClickListener(new View.OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// unlock home button and then screen on button press\n\t\t\t\tunlockHomeButton();\n\t\t\t}\n\t\t});\n\t}\n\n\t// Handle events of calls and unlock screen if necessary\n\tprivate class StateListener extends PhoneStateListener {\n\t\t@Override\n\t\tpublic void onCallStateChanged(int state, String incomingNumber) {\n\n\t\t\tsuper.onCallStateChanged(state, incomingNumber);\n\t\t\tswitch (state) {\n\t\t\tcase TelephonyManager.CALL_STATE_RINGING:\n\t\t\t\tunlockHomeButton();\n\t\t\t\tbreak;\n\t\t\tcase TelephonyManager.CALL_STATE_OFFHOOK:\n\t\t\t\tbreak;\n\t\t\tcase TelephonyManager.CALL_STATE_IDLE:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t};\n\n\t// Don't finish Activity on Back press\n\t@Override\n\tpublic void onBackPressed() {\n\t\treturn;\n\t}\n\n\t// Handle button clicks\n\t@Override\n\tpublic boolean onKeyDown(int keyCode, android.view.KeyEvent event) {\n\n\t\tif ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)\n\t\t\t\t|| (keyCode == KeyEvent.KEYCODE_POWER)\n\t\t\t\t|| (keyCode == KeyEvent.KEYCODE_VOLUME_UP)\n\t\t\t\t|| (keyCode == KeyEvent.KEYCODE_CAMERA)) {\n\t\t\treturn true;\n\t\t}\n\t\tif ((keyCode == KeyEvent.KEYCODE_HOME)) {\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\t// handle the key press events here itself\n\tpublic boolean dispatchKeyEvent(KeyEvent event) {\n\t\tif (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP\n\t\t\t\t|| (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)\n\t\t\t\t|| (event.getKeyCode() == KeyEvent.KEYCODE_POWER)) {\n\t\t\treturn false;\n\t\t}\n\t\tif ((event.getKeyCode() == KeyEvent.KEYCODE_HOME)) {\n\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t// Lock home button\n\tpublic void lockHomeButton() {\n\t\tmLockscreenUtils.lock(LockScreenActivity.this);\n\t}\n\n\t// Unlock home button and wait for its callback\n\tpublic void unlockHomeButton() {\n\t\tmLockscreenUtils.unlock();\n\t}\n\n\t// Simply unlock device when home button is successfully unlocked\n\t@Override\n\tpublic void onLockStatusChanged(boolean isLocked) {\n\t\tif (!isLocked) {\n\t\t\tunlockDevice();\n\t\t}\n\t}\n\n\t@Override\n\tprotected void onStop() {\n\t\tsuper.onStop();\n\t\tunlockHomeButton();\n\t}\n\n\t@SuppressWarnings(\"deprecation\")\n\tprivate void disableKeyguard() {\n\t\tKeyguardManager mKM = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);\n\t\tKeyguardManager.KeyguardLock mKL = mKM.newKeyguardLock(\"IN\");\n\t\tmKL.disableKeyguard();\n\t}\n\n\t@SuppressWarnings(\"deprecation\")\n\tprivate void enableKeyguard() {\n\t\tKeyguardManager mKM = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);\n\t\tKeyguardManager.KeyguardLock mKL = mKM.newKeyguardLock(\"IN\");\n\t\tmKL.reenableKeyguard();\n\t}\n\t\n\t//Simply unlock device by finishing the activity\n\tprivate void unlockDevice()\n\t{\n\t\tfinish();\n\t}\n\n}"
  },
  {
    "path": "LockScreenApp/src/com/mehuljoisar/lockscreen/utils/LockscreenIntentReceiver.java",
    "content": "package com.mehuljoisar.lockscreen.utils;\r\n\r\nimport android.content.BroadcastReceiver;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\n\r\nimport com.mehuljoisar.lockscreen.LockScreenActivity;\r\n\r\npublic class LockscreenIntentReceiver extends BroadcastReceiver {\r\n\r\n\t// Handle actions and display Lockscreen\r\n\t@Override\r\n\tpublic void onReceive(Context context, Intent intent) {\r\n\r\n\t\tif (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)\r\n\t\t\t\t|| intent.getAction().equals(Intent.ACTION_SCREEN_ON)\r\n\t\t\t\t|| intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {\r\n\t\t\tstart_lockscreen(context);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Display lock screen\r\n\tprivate void start_lockscreen(Context context) {\r\n\t\tIntent mIntent = new Intent(context, LockScreenActivity.class);\r\n\t\tmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n\t\tcontext.startActivity(mIntent);\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "LockScreenApp/src/com/mehuljoisar/lockscreen/utils/LockscreenService.java",
    "content": "package com.mehuljoisar.lockscreen.utils;\r\n\r\nimport android.app.Notification;\r\nimport android.app.Service;\r\nimport android.content.BroadcastReceiver;\r\nimport android.content.Intent;\r\nimport android.content.IntentFilter;\r\nimport android.graphics.Bitmap;\r\nimport android.os.IBinder;\r\nimport android.provider.SyncStateContract.Constants;\r\nimport android.support.v4.app.NotificationCompat;\r\n\r\nimport com.mehuljoisar.lockscreen.R;\r\n\r\npublic class LockscreenService extends Service {\r\n\r\n\tprivate BroadcastReceiver mReceiver;\r\n\r\n\t@Override\r\n\tpublic IBinder onBind(Intent intent) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onCreate() {\r\n\t\tsuper.onCreate();\r\n\t}\r\n\t\r\n\t// Register for Lockscreen event intents\r\n\t@Override\r\n\tpublic int onStartCommand(Intent intent, int flags, int startId) {\r\n\t\tIntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);\r\n\t\tfilter.addAction(Intent.ACTION_SCREEN_OFF);\r\n\t\tmReceiver = new LockscreenIntentReceiver();\r\n\t\tregisterReceiver(mReceiver, filter);\r\n\t\tstartForeground();\r\n\t\treturn START_STICKY;\r\n\t}\r\n\r\n\t// Run service in foreground so it is less likely to be killed by system\r\n\tprivate void startForeground() {\r\n\t\tNotification notification = new NotificationCompat.Builder(this)\r\n\t\t .setContentTitle(getResources().getString(R.string.app_name))\r\n\t\t .setTicker(getResources().getString(R.string.app_name))\r\n\t\t .setContentText(\"Running\")\r\n\t\t .setSmallIcon(R.drawable.ic_launcher)\r\n\t\t .setContentIntent(null)\r\n\t\t .setOngoing(true)\r\n\t\t .build();\r\n\t\t startForeground(9999,notification);\t\t\r\n\t}\r\n\r\n\t// Unregister receiver\r\n\t@Override\r\n\tpublic void onDestroy() {\r\n\t\tsuper.onDestroy();\r\n\t\tunregisterReceiver(mReceiver);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "LockScreenApp/src/com/mehuljoisar/lockscreen/utils/LockscreenUtils.java",
    "content": "package com.mehuljoisar.lockscreen.utils;\r\n\r\nimport android.app.Activity;\r\nimport android.app.AlertDialog;\r\nimport android.app.KeyguardManager;\r\nimport android.content.Context;\r\nimport android.view.Gravity;\r\nimport android.view.KeyEvent;\r\nimport android.view.MotionEvent;\r\nimport android.view.WindowManager;\r\nimport android.view.WindowManager.LayoutParams;\r\n\r\nimport com.mehuljoisar.lockscreen.R;\r\n\r\npublic class LockscreenUtils {\r\n\r\n\t// Member variables\r\n\tprivate OverlayDialog mOverlayDialog;\r\n\tprivate OnLockStatusChangedListener mLockStatusChangedListener;\r\n\t\r\n\t// Interface to communicate with owner activity\r\n\tpublic interface OnLockStatusChangedListener\r\n\t{\r\n\t\tpublic void onLockStatusChanged(boolean isLocked);\r\n\t}\r\n\t\r\n\t// Reset the variables\r\n\tpublic LockscreenUtils() {\r\n\t\treset();\r\n\t}\r\n\r\n\t// Display overlay dialog with a view to prevent home button click\r\n\tpublic void lock(Activity activity) {\r\n\t\tif (mOverlayDialog == null) {\r\n\t\t\tmOverlayDialog = new OverlayDialog(activity);\r\n\t\t\tmOverlayDialog.show();\r\n\t\t\tmLockStatusChangedListener = (OnLockStatusChangedListener) activity;\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Reset variables\r\n\tpublic void reset() {\r\n\t\tif (mOverlayDialog != null) {\r\n\t\t\tmOverlayDialog.dismiss();\r\n\t\t\tmOverlayDialog = null;\r\n\t\t}\r\n\t}\r\n\r\n\t// Unlock the home button and give callback to unlock the screen\r\n\tpublic void unlock() {\r\n\t\tif (mOverlayDialog != null) {\r\n\t\t\tmOverlayDialog.dismiss();\r\n\t\t\tmOverlayDialog = null;\r\n\t\t\tif(mLockStatusChangedListener!=null)\r\n\t\t\t{\r\n\t\t\t\tmLockStatusChangedListener.onLockStatusChanged(false);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Create overlay dialog for lockedscreen to disable hardware buttons\r\n\tprivate static class OverlayDialog extends AlertDialog {\r\n\r\n\t\tpublic OverlayDialog(Activity activity) {\r\n\t\t\tsuper(activity, R.style.OverlayDialog);\r\n\t\t\tWindowManager.LayoutParams params = getWindow().getAttributes();\r\n\t\t\tparams.type = LayoutParams.TYPE_SYSTEM_ERROR;\r\n\t\t\tparams.dimAmount = 0.0F;\r\n\t\t\tparams.width = 0;\r\n\t\t\tparams.height = 0;\r\n\t\t\tparams.gravity = Gravity.BOTTOM;\r\n\t\t\tgetWindow().setAttributes(params);\r\n\t\t\tgetWindow().setFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_NOT_TOUCH_MODAL,\r\n\t\t\t\t\t0xffffff);\r\n\t\t\tsetOwnerActivity(activity);\r\n\t\t\tsetCancelable(false);\r\n\t\t}\r\n\r\n\t\t// consume touch events\r\n\t\tpublic final boolean dispatchTouchEvent(MotionEvent motionevent) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "README.md",
    "content": "LockScreenApp\n=============\n\n\nFeatures:\n- Lockscreen over the screen\n- Hardware home button disabled\n- On-going notification to prevent app being killed by OS\n\nIt provides lockscreen in API 8 or above.\n\nInitial\n\n![Alt text](http://thumbnails114.imagebam.com/42319/f1a34d423182524.jpg \"\")\n\n\nLocked\n\n![Alt text](http://thumbnails114.imagebam.com/42319/422e11423182518.jpg \"\")\n\n\n\nUnlocked\n\n![Alt text](http://thumbnails114.imagebam.com/42319/f1a34d423182524.jpg \"\")\n\n\n\n"
  }
]