package Ġcom . nk ming . power menu Ċ Ċ import Ġandroid . content . Context Ċ Ċ object ĠPersistent View Helper Ċ { Ċ ĉ @ Jvm Static Ċ ĉ fun Ġstart If Ne cessary ( context : ĠContext ): ĠBoolean Ċ ĉ { Ċĉ ĉ val Ġpref Ġ= ĠPreference . from ( context ) Ċĉ ĉ if Ġ( pref . is Persistent View Enabled Ċĉĉĉ ĉ && Ġ! com . nk ming . utils . widget . Persistent Service . isRunning ()) Ċĉ ĉ { Ċĉĉ ĉ if Ġ(! ensure Permission ( context )) Ċĉĉ ĉ { Ċĉĉĉ ĉ return Ġfalse Ċĉĉ ĉ } Ċĉĉ ĉ else Ċĉĉ ĉ { Ċĉĉĉ ĉ Log . d ("$ LOG _ TAG . start If Ne cessary ", Ġ" Starting Ġservice ") Ċĉĉĉ ĉ Persistent Service . start ( context ) Ċĉĉĉ ĉ return Ġtrue Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ private Ġval ĠLOG _ TAG Ġ= ĠPersistent View Helper :: class . java . canonical Name ĊĊ ĉ private Ġfun Ġensure Permission ( context : ĠContext ): ĠBoolean Ċ ĉ { Ċĉ ĉ if Ġ( Permission Utils . has System Alert Window ( context )) Ċĉ ĉ { Ċĉĉ ĉ return Ġtrue Ċĉ ĉ } Ċĉ ĉ else Ċĉ ĉ { Ċĉĉ ĉ Log . d ("$ LOG _ TAG . ensure Permission ", Ġ" Missing Ġoverlay Ġpermission ") Ċĉĉ ĉ Permission Utils . request System Alert Window ( context ) Ċĉĉ ĉ return Ġfalse Ċĉ ĉ } Ċ ĉ } Ċ } Ċ