Page 1 of 4


Posted: 17 Sep 2014 12:08
by kintrupf
SmartUnlock is a huge set of flows (currently 41) which enables you to keep your phone unlocked as long as possible without sacrificing much (if any) in security.
Since a few new features are used the latest Automagic release 1.24 is required.
(191.68 KiB) Downloaded 2747 times
Although I named it "SmartUnlock" the flows will never actually unlock your phone. The flows will merely keep your phone unlocked while it is safe to do so.
"Safe" or "trusted" states are WiFi or Bluetooth connections, locations and such. The phone will not lock itself while at least one trusted state is present.
If the last trusted state is lost the phone will be automatically locked 5 minutes after the screen is switched off.

Once your is locked you need to unlock it yourself (enter the PIN), even if a trusted state is present. From then on it will be kept unlocked until the last trusted state is lost.

I developed the flows on a "Nexus 4" and a "Nexus 5" phone and find they work quite satisfactory :D

So, for example, the phone will not lock itself if:
  • you are connected to your home Wifi in the morning, phone is unlocked
  • then drive your car to work (phone automatically connects to car via Bluetooth)
  • at work the phone automatically connects to your work WiFi
If you later go for lunch and the WiFi connection is lost your phone automatically locks itself after 5 minutes.

Notification Icon
The current state of SmartUnlock is displayed as permanent notification icon. If the lock in the status bar is closed no trusted state is present. The notification drawer will display more info about the current state.
If you expand the SmartLock notification you can access the settings menu "Settings", lock the phone immediately with "Lock" (even if a trusted state is present) or unlock it permanently with "Unlock".
To later switch back to automatic mode select "Auto".
ExpandedNotification.jpg (8.49 KiB) Viewed 25268 times
I tried to make the installation as easy as possible:
  • Download and import the attached xml file.
    This will create a group "SmartUnlock" with all flows.
  • Do not enable any of the flows manually, the startup flow will enable all flows that need to be enabled at the time.
  • Edit the flow SmartUnlock_setPIN to set the PIN number to unlock your phone.
    You may also use any other unlock method, but it depends on your phone and Android version if they work properly when set by Automagic.
  • Manually execute the flow SmartUnlock_initSmartUnlock.
That's all! The rest is configured from the settings menu of the SmartUnlock notification icon.

All global variables used by SmartUnlock have the prefix "global_SmartUnlock_" and all flows start with "SmartUnlock_".

A few shortcuts are provided to access the settings menu or lock/unlock the phone. They are all named with the prefix "Shortcut: SmartUnlock_".

Settings menu
All options can be set from the settings menu. You can access it either from the expanded notification icon or from a Shortcut.
Main_menu.jpg (17.04 KiB) Viewed 25268 times
I hope the menu structure pretty much explains itself ;)
The numbers denote how many items are in the corresponding list.

Only enabled trusted states are listed here and can be edited.
To enable or disable a trusted state like "WiFi" or "Bluetooth" go to "SmartUnlock settings" and then to "Select available trusted states".

Available trusted states
  • WiFi connections
    SmartUnlock stores the ssid of trusted WiFi connections. While the phone is connected to any WiFi in the list it will not lock itself.
    To configure a new trusted WiFi connection you need to connect to the WiFi, then navigate through the SmartUnlock menu to "Add new WiFi connection".
  • Bluetooth connections
    SmartUnlock stores the device address of trusted Bluetooth devices. While the phone is connected to one or more devices from the list it will not lock itself.
    To configure a new trusted Bluetooth device you need to connect to the device, then navigate through the SmartUnlock menu to "Add new Bluetooth device".
  • Locations
    The phone will be kept unlocked while it is near a defined location. You can configure as many locations as you like.
    NOTE: the accuracy depends on the hardware of your phone and your location settings!

    Since Automagic only supports fixed locations within a location trigger or condition SmartUnlock will "clone" a new location flow when a new location is defined.
    For details look into the flow "SmartUnlock_cloneLocationTrigger". So for each new location you'll automatically get a new flow with a "fixed" location ;)
    To add a new location navigate through the SmartUnlock menu to "Add new trusted location". The phone will use your current location with a radius of 500m.
    If possible it will automatically get the street address from Google.
    You can later adjust latitude and longitude if you like.
  • Running Apps
    While any of the configured Apps is running in the foreground the phone will not lock itself. An example would be a shopping list which keeps your phone unlocked while you're walking through the aisles in the supermarket.
    To add a new trusted App navigate through the SmartUnlock menu to "Add new trusted App", then select the App from the list of installed Apps.
  • Timed unlock
    Keeps your phone unlocked for a certain amount of time (15 minutes, 30 minutes, 1 hour etc.) or until a certain time is reached (e.g. 19:30h).
    To set a new timeout select "Timed unlock" from the SmartUnlock main menu and then either select a duration like 15 minutes or a fixed time.
    The duration is rounded off to the nearest five or fifteen minutes, depending on duration length.
    If a timed unlock is set you can cancel it from the main menu.
  • Charging
    Keeps your phone unlocked while it is being charged with an AC charger, wireless (QI) or USB. You can select from the settings menu which charging methods are trusted.

Re: SmartUnlock

Posted: 17 Sep 2014 12:10
by kintrupf
Location_menu.jpg (11.83 KiB) Viewed 25246 times
TrustedState_menu.jpg (14.33 KiB) Viewed 25246 times
Timed_Unlock.jpg (10.69 KiB) Viewed 25246 times

Re: SmartUnlock

Posted: 18 Sep 2014 13:17
by steve7929
This looks pretty awesome. Can you please feel me how i can access the configuration page after i am done importing this flow?

Re: SmartUnlock

Posted: 18 Sep 2014 14:09
by kintrupf
Important: Run the flow SmartUnlock_initSmartUnlock once!

You should now have a new notification icon. Draw down the status bar, then expand the SmartUnlock notification to access the button for the settings menu.

Your can also create a shortcut on your homescreen. Select “AM Shortcut“, then “SmartUnlock configure“.

Re: SmartUnlock

Posted: 19 Sep 2014 04:38
by juandeargentina
pretty awesome job!!!

have you other flows to share?

Re: SmartUnlock

Posted: 20 Sep 2014 15:30
by steve7929
Is it possible to have a setting to enforce the settings only between a specific timeframe of the day?

Re: SmartUnlock

Posted: 20 Sep 2014 16:16
by kintrupf
Not yet, but it should be easy to add.
Would you need it (as example) for all WiFi connections our only for a specific one?

Re: SmartUnlock

Posted: 20 Sep 2014 19:15
by steve7929
For all connections please :)

Re: SmartUnlock

Posted: 06 Oct 2014 22:17
by zaini47
Pretty complex flow you made. Great work!

Re: SmartUnlock

Posted: 29 Nov 2014 05:25
by dlawrence
Awesome! Thank you!
I have a Note 4 and would rather use fingerprint to unlock when in an "untrusted" state. Is that possible? I can't figure that part out.