public class

RemotePreference

extends SelfRemovingPreference
java.lang.Object
   ↳ android.support.v7.preference.Preference
     ↳ lineageos.preference.SelfRemovingPreference
       ↳ lineageos.preference.RemotePreference

Class Overview

A RemotePreference is a view into preference logic which lives in another process. The primary use case for this is at the platform level where many applications may be contributing their preferences into the Settings app. A RemotePreference appears as a PreferenceScreen and redirects to the real application when clicked. The remote application can send events back to the preference when data changes and the view needs to be updated. See RemotePreferenceUpdater for a base class to use on the application side which implements the listeners and protocol. The interprocess communication is realized using BroadcastReceivers. When the application wants to update the RemotePreference with new data, it sends an ACTION_REFRESH_PREFERENCE with a particular Uri. The RemotePreference listens while attached, and performs an ordered broadcast with ACTION_UPDATE_PREFERENCE back to the application, which is then returned to the preference after being filled with new data. The external activity should include the META_REMOTE_RECEIVER and (optionally) the META_REMOTE_KEY strings in it's metadata. META_REMOTE_RECEIVER must contain the class name of the RemotePreferenceUpdater which we should request updates from. META_REMOTE_KEY must contain the key used by the preference which should match on both sides.

Summary

Constants
String ACTION_REFRESH_PREFERENCE
String ACTION_UPDATE_PREFERENCE
String EXTRA_ENABLED
String EXTRA_KEY
String EXTRA_SUMMARY
String META_REMOTE_KEY
String META_REMOTE_RECEIVER
[Expand]
Inherited Constants
From class android.support.v7.preference.Preference
Fields
protected final Context mContext
Public Constructors
RemotePreference(Context context, AttributeSet attrs, int defStyle, int defStyleRes)
RemotePreference(Context context, AttributeSet attrs, int defStyle)
RemotePreference(Context context, AttributeSet attrs)
Public Methods
Intent getReceiverIntent()
void onAttached()
void onDetached()
void onRemoteUpdated(Bundle bundle)
Protected Methods
String getRemoteKey(Bundle metaData)
[Expand]
Inherited Methods
From class lineageos.preference.SelfRemovingPreference
From class android.support.v7.preference.Preference
From class java.lang.Object
From interface java.lang.Comparable

Constants

public static final String ACTION_REFRESH_PREFERENCE

added in API level 8

Constant Value: "lineageos.intent.action.REFRESH_PREFERENCE"

public static final String ACTION_UPDATE_PREFERENCE

added in API level 8

Constant Value: "lineageos.intent.action.UPDATE_PREFERENCE"

public static final String EXTRA_ENABLED

added in API level 8

Constant Value: ":lineage:pref_enabled"

public static final String EXTRA_KEY

added in API level 8

Constant Value: ":lineage:pref_key"

public static final String EXTRA_SUMMARY

added in API level 8

Constant Value: ":lineage:pref_summary"

public static final String META_REMOTE_KEY

added in API level 8

Constant Value: "org.lineageos.settings.summary.key"

public static final String META_REMOTE_RECEIVER

added in API level 8

Constant Value: "org.lineageos.settings.summary.receiver"

Fields

protected final Context mContext

added in API level 8

Public Constructors

public RemotePreference (Context context, AttributeSet attrs, int defStyle, int defStyleRes)

added in API level 8

Parameters
context Context
attrs AttributeSet
defStyle int
defStyleRes int

public RemotePreference (Context context, AttributeSet attrs, int defStyle)

added in API level 8

Parameters
context Context
attrs AttributeSet
defStyle int

public RemotePreference (Context context, AttributeSet attrs)

added in API level 8

Parameters
context Context
attrs AttributeSet

Public Methods

public Intent getReceiverIntent ()

added in API level 8

Returns
Intent

public void onAttached ()

public void onDetached ()

public void onRemoteUpdated (Bundle bundle)

added in API level 8

Parameters
bundle Bundle

Protected Methods

protected String getRemoteKey (Bundle metaData)

added in API level 8

Parameters
metaData Bundle
Returns
String