mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-26 01:37:28 +00:00
Add 'constraints' and 'key preferences' sections to logs.
This commit is contained in:
@@ -232,9 +232,11 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
|||||||
this.clearKeyReceiver = new BroadcastReceiver() {
|
this.clearKeyReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.i(TAG, "onReceive() for clear key event");
|
Log.i(TAG, "onReceive() for clear key event. PasswordDisabled: " + TextSecurePreferences.isPasswordDisabled(context) + ", ScreenLock: " + TextSecurePreferences.isScreenLockEnabled(context));
|
||||||
|
if (TextSecurePreferences.isScreenLockEnabled(context) || !TextSecurePreferences.isPasswordDisabled(context)) {
|
||||||
onMasterSecretCleared();
|
onMasterSecretCleared();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT);
|
IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT);
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
package org.thoughtcrime.securesms.logsubmit;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
|
import org.thoughtcrime.securesms.jobmanager.Constraint;
|
||||||
|
import org.thoughtcrime.securesms.jobs.JobManagerFactories;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
final class LogSectionConstraints implements LogSection {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull String getTitle() {
|
||||||
|
return "CONSTRAINTS";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull CharSequence getContent(@NonNull Context context) {
|
||||||
|
StringBuilder output = new StringBuilder();
|
||||||
|
Map<String, Constraint.Factory> factories = JobManagerFactories.getConstraintFactories(ApplicationDependencies.getApplication());
|
||||||
|
int keyLength = Stream.of(factories.keySet()).map(String::length).max(Integer::compareTo).orElse(0);
|
||||||
|
|
||||||
|
for (Map.Entry<String, Constraint.Factory> entry : factories.entrySet()) {
|
||||||
|
output.append(Util.rightPad(entry.getKey(), keyLength)).append(": ").append(entry.getValue().create().isMet()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
package org.thoughtcrime.securesms.logsubmit;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
|
final class LogSectionKeyPreferences implements LogSection {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull String getTitle() {
|
||||||
|
return "KEY PREFERENCES";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull CharSequence getContent(@NonNull Context context) {
|
||||||
|
return new StringBuilder().append("Screen Lock : ").append(TextSecurePreferences.isScreenLockEnabled(context)).append("\n")
|
||||||
|
.append("Screen Lock Timeout : ").append(TextSecurePreferences.getScreenLockTimeout(context)).append("\n")
|
||||||
|
.append("Password Disabled : ").append(TextSecurePreferences.isPasswordDisabled(context)).append("\n")
|
||||||
|
.append("WiFi SMS : ").append(TextSecurePreferences.isWifiSmsEnabled(context)).append("\n")
|
||||||
|
.append("Default SMS : ").append(Util.isDefaultSmsProvider(context)).append("\n")
|
||||||
|
.append("Prefer Contact Photos: ").append(SignalStore.settings().isPreferSystemContactPhotos()).append("\n")
|
||||||
|
.append("Call Bandwidth Mode : ").append(SignalStore.settings().getCallBandwidthMode()).append("\n")
|
||||||
|
.append("Client Deprecated : ").append(SignalStore.misc().isClientDeprecated()).append("\n");
|
||||||
|
}
|
||||||
|
}
|
@@ -20,6 +20,7 @@ import org.thoughtcrime.securesms.util.CensorshipUtil;
|
|||||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
import org.thoughtcrime.securesms.util.VersionTracker;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -60,6 +61,7 @@ public class LogSectionSystemInfo implements LogSection {
|
|||||||
builder.append("Locale : ").append(Locale.getDefault().toString()).append("\n");
|
builder.append("Locale : ").append(Locale.getDefault().toString()).append("\n");
|
||||||
builder.append("Linked Devices: ").append(TextSecurePreferences.isMultiDevice(context)).append("\n");
|
builder.append("Linked Devices: ").append(TextSecurePreferences.isMultiDevice(context)).append("\n");
|
||||||
builder.append("First Version : ").append(TextSecurePreferences.getFirstInstallVersion(context)).append("\n");
|
builder.append("First Version : ").append(TextSecurePreferences.getFirstInstallVersion(context)).append("\n");
|
||||||
|
builder.append("Days Installed: ").append(VersionTracker.getDaysSinceFirstInstalled(context)).append("\n");
|
||||||
builder.append("App : ");
|
builder.append("App : ");
|
||||||
try {
|
try {
|
||||||
builder.append(pm.getApplicationLabel(pm.getApplicationInfo(context.getPackageName(), 0)))
|
builder.append(pm.getApplicationLabel(pm.getApplicationInfo(context.getPackageName(), 0)))
|
||||||
|
@@ -54,12 +54,14 @@ public class SubmitDebugLogRepository {
|
|||||||
private static final List<LogSection> SECTIONS = new ArrayList<LogSection>() {{
|
private static final List<LogSection> SECTIONS = new ArrayList<LogSection>() {{
|
||||||
add(new LogSectionSystemInfo());
|
add(new LogSectionSystemInfo());
|
||||||
add(new LogSectionJobs());
|
add(new LogSectionJobs());
|
||||||
|
add(new LogSectionConstraints());
|
||||||
if (Build.VERSION.SDK_INT >= 28) {
|
if (Build.VERSION.SDK_INT >= 28) {
|
||||||
add(new LogSectionPower());
|
add(new LogSectionPower());
|
||||||
}
|
}
|
||||||
add(new LogSectionPin());
|
add(new LogSectionPin());
|
||||||
add(new LogSectionCapabilities());
|
add(new LogSectionCapabilities());
|
||||||
add(new LogSectionFeatureFlags());
|
add(new LogSectionFeatureFlags());
|
||||||
|
add(new LogSectionKeyPreferences());
|
||||||
add(new LogSectionPermissions());
|
add(new LogSectionPermissions());
|
||||||
add(new LogSectionTrace());
|
add(new LogSectionTrace());
|
||||||
add(new LogSectionThreads());
|
add(new LogSectionThreads());
|
||||||
|
@@ -80,7 +80,13 @@ public class KeyCachingService extends Service {
|
|||||||
public KeyCachingService() {}
|
public KeyCachingService() {}
|
||||||
|
|
||||||
public static synchronized boolean isLocked(Context context) {
|
public static synchronized boolean isLocked(Context context) {
|
||||||
return masterSecret == null && (!TextSecurePreferences.isPasswordDisabled(context) || TextSecurePreferences.isScreenLockEnabled(context));
|
boolean locked = masterSecret == null && (!TextSecurePreferences.isPasswordDisabled(context) || TextSecurePreferences.isScreenLockEnabled(context));
|
||||||
|
|
||||||
|
if (locked) {
|
||||||
|
Log.d(TAG, "Locked! PasswordDisabled: " + TextSecurePreferences.isPasswordDisabled(context) + ", ScreenLock: " + TextSecurePreferences.isScreenLockEnabled(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
return locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized @Nullable MasterSecret getMasterSecret(Context context) {
|
public static synchronized @Nullable MasterSecret getMasterSecret(Context context) {
|
||||||
|
Reference in New Issue
Block a user