mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Make field that's used on background thread volatile.
This commit is contained in:
@@ -26,7 +26,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
|||||||
Logger.getLogger(SetupControllerImpl.class.getName());
|
Logger.getLogger(SetupControllerImpl.class.getName());
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private SetupActivity setupActivity; // TODO: Should be volatile
|
private volatile SetupActivity setupActivity;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
SetupControllerImpl(SharedPreferences briarPrefs,
|
SetupControllerImpl(SharedPreferences briarPrefs,
|
||||||
@@ -44,6 +44,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needToShowDozeFragment() {
|
public boolean needToShowDozeFragment() {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
return DozeView.needsToBeShown(setupActivity) ||
|
return DozeView.needsToBeShown(setupActivity) ||
|
||||||
HuaweiView.needsToBeShown(setupActivity);
|
HuaweiView.needsToBeShown(setupActivity);
|
||||||
@@ -51,31 +52,35 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAuthorName(String authorName) {
|
public void setAuthorName(String authorName) {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
setupActivity.setAuthorName(authorName);
|
setupActivity.setAuthorName(authorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
setupActivity.setPassword(password);
|
setupActivity.setPassword(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showPasswordFragment() {
|
public void showPasswordFragment() {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
setupActivity.showPasswordFragment();
|
setupActivity.showPasswordFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showDozeFragment() {
|
public void showDozeFragment() {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
setupActivity.showDozeFragment();
|
setupActivity.showDozeFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createAccount() {
|
public void createAccount() {
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
UiResultHandler<Void> resultHandler =
|
UiResultHandler<Void> resultHandler =
|
||||||
new UiResultHandler<Void>(setupActivity) {
|
new UiResultHandler<Void>(setupActivity) {
|
||||||
@Override
|
@Override
|
||||||
@@ -90,6 +95,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
|||||||
|
|
||||||
// Package access for testing
|
// Package access for testing
|
||||||
void createAccount(ResultHandler<Void> resultHandler) {
|
void createAccount(ResultHandler<Void> resultHandler) {
|
||||||
|
SetupActivity setupActivity = this.setupActivity;
|
||||||
if (setupActivity == null) throw new IllegalStateException();
|
if (setupActivity == null) throw new IllegalStateException();
|
||||||
String authorName = setupActivity.getAuthorName();
|
String authorName = setupActivity.getAuthorName();
|
||||||
if (authorName == null) throw new IllegalStateException();
|
if (authorName == null) throw new IllegalStateException();
|
||||||
|
|||||||
Reference in New Issue
Block a user