public class AnalyticsSettings
extends java.lang.Object
Constructor and Description |
---|
AnalyticsSettings() |
Modifier and Type | Method and Description |
---|---|
static AnalyticsSettings |
createNewAnalyticsSettings()
Creates a new settings object and writes it to disk.
|
static AnalyticsSettings |
getInstance(com.android.utils.ILogger logger)
Get or creates an instance of the settings.
|
byte[] |
getSalt()
Gets a binary blob to ensure per user anonymization.
|
java.lang.String |
getUserId()
Gets a user id used for reporting analytics.
|
boolean |
hasDebugDisablePublishing()
Indicates whether the user has disabled publishing for debugging purposes.
|
boolean |
hasOptedIn()
Indicates whether the user has opted in to sending analytics reporting to Google.
|
static AnalyticsSettings |
loadSettings()
Loads an existing settings file from disk, or creates a new valid settings object if none
exists.
|
void |
saveSettings()
Writes this settings object to disk.
|
void |
setHasOptedIn(boolean mHasOptedIn)
Sets the user's choice for opting in to sending analytics reporting to Google or not.
|
static void |
setInstanceForTest(AnalyticsSettings settings)
Allows test to set a custom version of the AnalyticsSettings to test different setting
states.
|
void |
setUserId(java.lang.String userId)
Sets a new user id to be used for reporting analytics.
|
public java.lang.String getUserId()
public boolean hasOptedIn()
public void setUserId(java.lang.String userId)
public void setHasOptedIn(boolean mHasOptedIn)
public boolean hasDebugDisablePublishing()
public byte[] getSalt() throws java.io.IOException
Anonymizer
.java.io.IOException
@Nullable public static AnalyticsSettings loadSettings() throws java.io.IOException
java.io.IOException
- if there are any issues reading the settings file.@NonNull public static AnalyticsSettings createNewAnalyticsSettings() throws java.io.IOException
java.io.IOException
- if there are any issues writing the settings file.public static AnalyticsSettings getInstance(com.android.utils.ILogger logger)
public static void setInstanceForTest(@Nullable AnalyticsSettings settings)
public void saveSettings() throws java.io.IOException
java.io.IOException
- if there are any issues writing the settings file.