0008-Bug-28051-Make-TorService-compatible-with-the-suppor.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From a99a14cefc17e50dc2eafb0c99760dd8e09aaabd Mon Sep 17 00:00:00 2001
  2. From: Matthew Finkel <Matthew.Finkel@gmail.com>
  3. Date: Sat, 24 Nov 2018 04:49:59 +0000
  4. Subject: [PATCH 08/13] Bug 28051 - Make TorService compatible with the support
  5. libraries
  6. ---
  7. .../org/torproject/android/service/TorService.java | 11 ++++++++---
  8. 1 file changed, 8 insertions(+), 3 deletions(-)
  9. diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
  10. index edd0e3d5..a12a97bd 100644
  11. --- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
  12. +++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
  13. @@ -35,7 +35,10 @@ import android.os.Build;
  14. import android.os.IBinder;
  15. import android.os.RemoteException;
  16. import android.provider.BaseColumns;
  17. -import android.support.annotation.RequiresApi;
  18. +// Not available in 23.4.0
  19. +// https://developer.android.com/reference/android/support/annotation/RequiresApi
  20. +//import android.support.annotation.RequiresApi;
  21. +import android.annotation.TargetApi;
  22. import android.support.v4.app.NotificationCompat;
  23. import android.support.v4.content.LocalBroadcastManager;
  24. import android.text.TextUtils;
  25. @@ -250,7 +253,10 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
  26. private final static String NOTIFICATION_CHANNEL_ID = "orbot_channel_1";
  27. - @RequiresApi(api = Build.VERSION_CODES.O)
  28. + // Use TargetApi until we use a support library version that adds the
  29. + // RequriesApi annotation
  30. + //@RequiresApi(api = Build.VERSION_CODES.O)
  31. + @TargetApi(value = Build.VERSION_CODES.O)
  32. private void createNotificationChannel ()
  33. {
  34. NotificationManager mNotificationManager =
  35. @@ -300,7 +306,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
  36. mNotifyBuilder.setCategory(Notification.CATEGORY_SERVICE);
  37. - mNotifyBuilder.setChannelId(NOTIFICATION_CHANNEL_ID);
  38. Intent intentRefresh = new Intent();
  39. --
  40. 2.17.1