首次开机后,进入设置-》账户-》菜单按键 ,自动同步数据,默认如何关闭?
alps\frameworks\base\core\java\android\content\SyncStorageEngine.java
JB之前的版本上(不含JB)默认为自动同步,修改为False,则不会自动同步.
mMasterSyncAutomatically=Ture – 》 False
JB之后的版本上(包含JB)需做以下修改:
1.
public boolean getMasterSyncAutomatically(int userId) {
synchronized (mAuthorities) {
Boolean auto = mMasterSyncAutomatically.get(userId);
Log.d(TAG, "userId=" + userId + " auto=" + auto + " mExt=" + mExt);
if (mExt != null && mExt.getCurrentOPIndex() == 1) {
// /M: add for cmccc when there is no account default auto sync
// is off
Log.d(TAG,
"mExt.getCurrentOPIndex()=" + mExt.getCurrentOPIndex());
// 若是CMCC的project 修改这里 将原来 false ,改为 ture 谢谢!
return auto == null ? false : auto;
// 修改结束
} else {
// 若是非CMCC的project 修改这里的 ,当前默认选中,若需默认不同步需更改为false
return auto == null ? true : auto;
}
// return auto == null ? mDefaultMasterSyncAutomatically : auto;
}
}
alps\frameworks\base\services\core\java\com\android\server\content\SyncStorageEngine.java
public boolean getMasterSyncAutomatically(int userId) {
synchronized (mAuthorities) {
Boolean auto = mMasterSyncAutomatically.get(userId);
// /M: add for cmccc when there is no account default auto sync is
// off
if (mSyncManagerExt == null) {
return auto == null ? true : auto; // 非运营商定制,则将默认的true更改为false
}
// OP01中国移动 是在这个api内获取的,因此需要找到这个api的文件所在路径,将这个api返回值由false修改为true
// 文件路径是SyncManagerOPExt.java
// (alps\mediatek\operator\op01\frameworks\java\com\mediatek\op\accountsync)
boolean isAutomatically = mSyncManagerExt.getSyncAutomatically();
Log.d(TAG, "mSyncManagerExt.getSyncAutomatically() = "
+ isAutomatically);
return auto == null ? isAutomatically : auto;
// return auto == null ? mDefaultMasterSyncAutomatically : auto;
}
}
2.
private void readAccountInfoLocked() {
...
mMasterSyncAutomatically.put(0, listen == null ||
Boolean.parseBoolean(listen));
修改为:
mMasterSyncAutomatically.put(0, Boolean.parseBoolean(listen));
请修改完之后再测试。