Skip to content

Commit

Permalink
Fix API 34 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Sep 4, 2024
1 parent d7e9fa7 commit 8a1bdc4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 41 deletions.
10 changes: 5 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,11 +1085,6 @@
android:name=".service.KeyCachingService"
android:foregroundServiceType="remoteMessaging"/>

<service
android:enabled="true"
android:exported="false"
android:name=".service.WipeMemoryService" />

<service
android:enabled="true"
android:name=".messages.IncomingMessageObserver$ForegroundService"
Expand Down Expand Up @@ -1168,6 +1163,11 @@

<!-- MOLLY: FcmReceiveService moved to gms/AndroidManifest.xml -->

<service
android:name=".service.WipeMemoryService"
android:exported="false"
android:foregroundServiceType="remoteMessaging" />

<receiver android:name=".notifications.MarkReadReceiver"
android:enabled="true"
android:exported="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ public void onLowMemory() {
super.onLowMemory();
}

@Override
public void onTimeout(int startId) {
notifyLowMemory();
Log.i(TAG, "onTimeout()");
super.onTimeout(startId);
}

private void notifyLowMemory() {
lowMemory = true;
}
Expand Down
2 changes: 1 addition & 1 deletion libnetcipher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ android {

dependencies {
implementation project(':core-util')
implementation libs.androidx.annotation
implementation libs.androidx.fragment
lintChecks project(':lintchecks')
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.text.TextUtils;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import org.signal.core.util.logging.Log;

Expand Down Expand Up @@ -511,8 +512,9 @@ public boolean init() {
if (orbot != null) {
isInstalled = true;
handler.postDelayed(onStatusTimeout, statusTimeoutMs);
context.registerReceiver(orbotStatusReceiver,
new IntentFilter(OrbotHelper.ACTION_STATUS));
ContextCompat.registerReceiver(context, orbotStatusReceiver,
new IntentFilter(OrbotHelper.ACTION_STATUS),
ContextCompat.RECEIVER_EXPORTED);
context.sendBroadcast(orbot);
} else {
isInstalled = false;
Expand All @@ -525,39 +527,6 @@ public boolean init() {
return (isInstalled);
}

/**
* Given that init() returned false, calling installOrbot()
* will trigger an attempt to install Orbot from an available
* distribution channel (e.g., the Play Store). Only call this
* if the user is expecting it, such as in response to tapping
* a dialog button or an action bar item.
* <p>
* Note that installation may take a long time, even if
* the user is proceeding with the installation, due to network
* speeds, waiting for user input, and so on. Either specify
* a long timeout, or consider the timeout to be merely advisory
* and use some other user input to cause you to try
* init() again after, presumably, Orbot has been installed
* and configured by the user.
* <p>
* If the user does install Orbot, we will attempt init()
* again automatically. Hence, you will probably need user input
* to tell you when the user has gotten Orbot up and going.
*
* @param host the Activity that is triggering this work
*/
public void installOrbot(Activity host) {
handler.postDelayed(onInstallTimeout, installTimeoutMs);

IntentFilter filter =
new IntentFilter(Intent.ACTION_PACKAGE_ADDED);

filter.addDataScheme("package");

context.registerReceiver(orbotInstallReceiver, filter);
host.startActivity(OrbotHelper.getOrbotInstallIntent(context));
}

private BroadcastReceiver orbotStatusReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Expand Down

0 comments on commit 8a1bdc4

Please sign in to comment.