Skip to content

Commit 2b5d0ea

Browse files
yamengjredestig
authored andcommitted
Make default value of auto-sync in SyncStorageEngine configurable
This will make the default value of the automatic synchronization in the SyncStorageEngine configurable with overlays for use by vendors who want or have legal requirements to have the synchronization off by default. Change-Id: Iabdb355c4a1169fe8e254e91c43e162c5913d5e0
1 parent 0dab1a1 commit 2b5d0ea

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

core/java/android/content/SyncStorageEngine.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import android.accounts.Account;
2828
import android.accounts.AccountAndUser;
29+
import android.content.res.Resources;
2930
import android.database.Cursor;
3031
import android.database.sqlite.SQLiteDatabase;
3132
import android.database.sqlite.SQLiteException;
@@ -337,6 +338,7 @@ interface OnSyncRequestListener {
337338

338339
private int mNextHistoryId = 0;
339340
private SparseArray<Boolean> mMasterSyncAutomatically = new SparseArray<Boolean>();
341+
private boolean mDefaultMasterSyncAutomatically;
340342

341343
private OnSyncRequestListener mSyncRequestListener;
342344

@@ -346,6 +348,9 @@ private SyncStorageEngine(Context context, File dataDir) {
346348

347349
mCal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0"));
348350

351+
mDefaultMasterSyncAutomatically = mContext.getResources().getBoolean(
352+
com.android.internal.R.bool.config_syncstorageengine_masterSyncAutomatically);
353+
349354
File systemDir = new File(dataDir, "system");
350355
File syncDir = new File(systemDir, "sync");
351356
syncDir.mkdirs();
@@ -781,7 +786,7 @@ public void setMasterSyncAutomatically(boolean flag, int userId) {
781786
public boolean getMasterSyncAutomatically(int userId) {
782787
synchronized (mAuthorities) {
783788
Boolean auto = mMasterSyncAutomatically.get(userId);
784-
return auto == null ? true : auto;
789+
return auto == null ? mDefaultMasterSyncAutomatically : auto;
785790
}
786791
}
787792

core/res/res/values/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,4 +865,7 @@
865865

866866
<!-- Set to true to add links to Cell Broadcast app from Settings and MMS app. -->
867867
<bool name="config_cellBroadcastAppLinks">false</bool>
868+
869+
<!-- The default value if the SyncStorageEngine should sync automatically or not -->
870+
<bool name="config_syncstorageengine_masterSyncAutomatically">true</bool>
868871
</resources>

core/res/res/values/public.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
<java-symbol type="bool" name="config_sms_capable" />
254254
<java-symbol type="bool" name="config_sms_utf8_support" />
255255
<java-symbol type="bool" name="config_swipeDisambiguation" />
256+
<java-symbol type="bool" name="config_syncstorageengine_masterSyncAutomatically" />
256257
<java-symbol type="bool" name="config_telephony_use_own_number_for_voicemail" />
257258
<java-symbol type="bool" name="config_ui_enableFadingMarquee" />
258259
<java-symbol type="bool" name="config_use_strict_phone_number_comparation" />

0 commit comments

Comments
 (0)