public class ApprovedPrintServices extends Object
Modifier and Type | Field and Description |
---|---|
static Object |
sLock
Used for locking accesses to the approved services.
|
Constructor and Description |
---|
ApprovedPrintServices(Context owner)
Create a new
ApprovedPrintServices |
Modifier and Type | Method and Description |
---|---|
void |
addApprovedService(ComponentName serviceToAdd)
Add a
PrintService to the list of approved print services. |
Set<String> |
getApprovedServices()
Get
Set of approved services. |
boolean |
isApprovedService(ComponentName service)
Check if a
PrintService is approved. |
void |
pruneApprovedServices(List<ComponentName> serviceNamesToKeep)
Remove all approved
print services that are not in the given set. |
void |
registerChangeListenerLocked(SharedPreferences.OnSharedPreferenceChangeListener listener)
Add a
SharedPreferences.OnSharedPreferenceChangeListener that listens for changes to the approved
services. |
void |
unregisterChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener)
Unregister a listener registered in
registerChangeListenerLocked(android.content.SharedPreferences.OnSharedPreferenceChangeListener) . |
public static final Object sLock
public ApprovedPrintServices(Context owner)
ApprovedPrintServices
owner
- The Context
using this object.public Set<String> getApprovedServices()
Set
of approved services.Set
containing all currently approved services.public boolean isApprovedService(ComponentName service)
PrintService
is approved.
This function does not acquire the sLock
.service
- The ComponentName
of the PrintService
that might be approvedpublic void addApprovedService(ComponentName serviceToAdd)
PrintService
to the list of approved print services.serviceToAdd
- The ComponentName
of the PrintService
to be approved.public void registerChangeListenerLocked(SharedPreferences.OnSharedPreferenceChangeListener listener)
SharedPreferences.OnSharedPreferenceChangeListener
that listens for changes to the approved
services. Should only be called while holding sLock
to synchronize against
addApprovedService(android.content.ComponentName)
.listener
- SharedPreferences.OnSharedPreferenceChangeListener
to registerpublic void unregisterChangeListener(SharedPreferences.OnSharedPreferenceChangeListener listener)
registerChangeListenerLocked(android.content.SharedPreferences.OnSharedPreferenceChangeListener)
.listener
- SharedPreferences.OnSharedPreferenceChangeListener
to unregisterpublic void pruneApprovedServices(List<ComponentName> serviceNamesToKeep)
print services
that are not in the given set.serviceNamesToKeep
- The names
of the services to keep