diff --git a/src/org/thoughtcrime/securesms/BaseActionBarActivity.java b/src/org/thoughtcrime/securesms/BaseActionBarActivity.java index 8bfb664cb6..e6b5ea5684 100644 --- a/src/org/thoughtcrime/securesms/BaseActionBarActivity.java +++ b/src/org/thoughtcrime/securesms/BaseActionBarActivity.java @@ -52,9 +52,7 @@ public abstract class BaseActionBarActivity extends AppCompatActivity { } private void initializeScreenshotSecurity() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && - TextSecurePreferences.isScreenSecurityEnabled(this)) - { + if (TextSecurePreferences.isScreenSecurityEnabled(this)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); diff --git a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java index 49b3cc3bec..e6c244b238 100644 --- a/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java +++ b/src/org/thoughtcrime/securesms/ContactSelectionListFragment.java @@ -135,8 +135,7 @@ public class ContactSelectionListFragment extends Fragment showContactsProgress = view.findViewById(R.id.progress); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); - swipeRefresh.setEnabled(getActivity().getIntent().getBooleanExtra(REFRESHABLE, true) && - Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN); + swipeRefresh.setEnabled(getActivity().getIntent().getBooleanExtra(REFRESHABLE, true)); return view; } diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index de333787b7..4748f04e7a 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -71,18 +71,15 @@ import org.thoughtcrime.securesms.components.reminder.ServiceOutageReminder; import org.thoughtcrime.securesms.components.reminder.ShareReminder; import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder; import org.thoughtcrime.securesms.components.reminder.UnauthorizedReminder; -import org.thoughtcrime.securesms.components.reminder.UnsupportedAndroidVersionReminder; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo; import org.thoughtcrime.securesms.database.loaders.ConversationListLoader; import org.thoughtcrime.securesms.events.ReminderUpdateEvent; import org.thoughtcrime.securesms.jobs.ServiceOutageDetectionJob; -import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.mms.GlideApp; import org.thoughtcrime.securesms.notifications.MarkReadReceiver; import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.recipients.Recipient; -import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.ViewUtil; import org.thoughtcrime.securesms.util.task.SnackbarAsyncTask; @@ -202,8 +199,6 @@ public class ConversationListFragment extends Fragment final Context context = params[0]; if (UnauthorizedReminder.isEligible(context)) { return Optional.of(new UnauthorizedReminder(context)); - } else if (UnsupportedAndroidVersionReminder.isEligible()) { - return Optional.of(new UnsupportedAndroidVersionReminder(context)); } else if (ExpiredBuildReminder.isEligible()) { return Optional.of(new ExpiredBuildReminder(context)); } else if (ServiceOutageReminder.isEligible(context)) { diff --git a/src/org/thoughtcrime/securesms/PassphrasePromptActivity.java b/src/org/thoughtcrime/securesms/PassphrasePromptActivity.java index b0aa6bb53a..0d8f4cec8c 100644 --- a/src/org/thoughtcrime/securesms/PassphrasePromptActivity.java +++ b/src/org/thoughtcrime/securesms/PassphrasePromptActivity.java @@ -262,13 +262,13 @@ public class PassphrasePromptActivity extends PassphraseActivity { assert keyguardManager != null; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && !keyguardManager.isKeyguardSecure()) { + if (!keyguardManager.isKeyguardSecure()) { Log.w(TAG ,"Keyguard not secure..."); handleAuthenticated(); return; } - if (Build.VERSION.SDK_INT >= 16 && fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) { + if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) { Log.i(TAG, "Listening for fingerprints..."); fingerprintCancellationSignal = new CancellationSignal(); fingerprintManager.authenticate(null, 0, fingerprintCancellationSignal, fingerprintListener, null); @@ -283,7 +283,7 @@ public class PassphrasePromptActivity extends PassphraseActivity { } private void pauseScreenLock() { - if (Build.VERSION.SDK_INT >= 16 && fingerprintCancellationSignal != null) { + if (fingerprintCancellationSignal != null) { fingerprintCancellationSignal.cancel(); } } diff --git a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java index 552dd0b122..f9e6337f92 100644 --- a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java +++ b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java @@ -483,30 +483,26 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity } private void setCodeSegment(final TextView codeView, String segment) { - if (Build.VERSION.SDK_INT >= 11) { - ValueAnimator valueAnimator = new ValueAnimator(); - valueAnimator.setObjectValues(0, Integer.parseInt(segment)); + ValueAnimator valueAnimator = new ValueAnimator(); + valueAnimator.setObjectValues(0, Integer.parseInt(segment)); - valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) - @Override - public void onAnimationUpdate(ValueAnimator animation) { - int value = (int) animation.getAnimatedValue(); - codeView.setText(String.format("%05d", value)); - } - }); + valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) + @Override + public void onAnimationUpdate(ValueAnimator animation) { + int value = (int) animation.getAnimatedValue(); + codeView.setText(String.format("%05d", value)); + } + }); - valueAnimator.setEvaluator(new TypeEvaluator() { - public Integer evaluate(float fraction, Integer startValue, Integer endValue) { - return Math.round(startValue + (endValue - startValue) * fraction); - } - }); + valueAnimator.setEvaluator(new TypeEvaluator() { + public Integer evaluate(float fraction, Integer startValue, Integer endValue) { + return Math.round(startValue + (endValue - startValue) * fraction); + } + }); - valueAnimator.setDuration(1000); - valueAnimator.start(); - } else { - codeView.setText(segment); - } + valueAnimator.setDuration(1000); + valueAnimator.start(); } private String[] getSegments(Fingerprint fingerprint, int segmentCount) { diff --git a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java index ffc6348e42..1058349028 100644 --- a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -121,9 +121,7 @@ public class WebRtcCallActivity extends Activity { } private void initializeScreenshotSecurity() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && - TextSecurePreferences.isScreenSecurityEnabled(this)) - { + if (TextSecurePreferences.isScreenSecurityEnabled(this)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE); diff --git a/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java b/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java index ba4ffb73d0..f81e09386f 100644 --- a/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java +++ b/src/org/thoughtcrime/securesms/components/AttachmentTypeSelector.java @@ -87,10 +87,6 @@ public class AttachmentTypeSelector extends PopupWindow { this.closeButton.setOnClickListener(new CloseClickListener()); this.recentRail.setListener(new RecentPhotoSelectedListener()); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - ViewUtil.findById(layout, R.id.location_linear_layout).setVisibility(View.INVISIBLE); - } - setContentView(layout); setWidth(LinearLayout.LayoutParams.MATCH_PARENT); setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); diff --git a/src/org/thoughtcrime/securesms/components/AudioView.java b/src/org/thoughtcrime/securesms/components/AudioView.java index dcf60f2aae..23546b71bc 100644 --- a/src/org/thoughtcrime/securesms/components/AudioView.java +++ b/src/org/thoughtcrime/securesms/components/AudioView.java @@ -218,10 +218,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener this.timestamp.setTextColor(foregroundTint); this.seekBar.getProgressDrawable().setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - this.seekBar.getThumb().setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN); - } + this.seekBar.getThumb().setColorFilter(foregroundTint, PorterDuff.Mode.SRC_IN); } private double getProgress() { diff --git a/src/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java b/src/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java index f225a9d646..c8a8124011 100644 --- a/src/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java +++ b/src/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java @@ -73,15 +73,9 @@ public class ConversationItemThumbnail extends FrameLayout { @SuppressWarnings("SuspiciousNameCombination") @Override protected void dispatchDraw(Canvas canvas) { - if (cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } - super.dispatchDraw(canvas); - if (!cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } + cornerMask.mask(canvas); if (album.getVisibility() != VISIBLE) { outliner.draw(canvas); diff --git a/src/org/thoughtcrime/securesms/components/CornerMask.java b/src/org/thoughtcrime/securesms/components/CornerMask.java index 085df25574..ce12259ec9 100644 --- a/src/org/thoughtcrime/securesms/components/CornerMask.java +++ b/src/org/thoughtcrime/securesms/components/CornerMask.java @@ -20,11 +20,7 @@ public class CornerMask { private final RectF bounds = new RectF(); public CornerMask(@NonNull View view) { - if (isLegacy()) { - view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } else { - view.setLayerType(View.LAYER_TYPE_HARDWARE, null); - } + view.setLayerType(View.LAYER_TYPE_HARDWARE, null); clearPaint.setColor(Color.BLACK); clearPaint.setStyle(Paint.Style.FILL); @@ -42,21 +38,12 @@ public class CornerMask { corners.addRoundRect(bounds, radii, Path.Direction.CW); // Note: There's a bug in the P beta where most PorterDuff modes aren't working. But CLEAR does. - // So we find and inverse path and use Mode.CLEAR for versions that support Path.op(). + // So we find and inverse path and use Mode.CLEAR. // See issue https://issuetracker.google.com/issues/111394085. - if (!isLegacy()) { - outline.reset(); - outline.addRect(bounds, Path.Direction.CW); - outline.op(corners, Path.Op.DIFFERENCE); - canvas.drawPath(outline, clearPaint); - } else { - corners.addRoundRect(bounds, radii, Path.Direction.CW); - canvas.clipPath(corners); - } - } - - public boolean isLegacy() { - return Build.VERSION.SDK_INT < 19; + outline.reset(); + outline.addRect(bounds, Path.Direction.CW); + outline.op(corners, Path.Op.DIFFERENCE); + canvas.drawPath(outline, clearPaint); } public void setRadius(int radius) { diff --git a/src/org/thoughtcrime/securesms/components/HourglassView.java b/src/org/thoughtcrime/securesms/components/HourglassView.java index e10d61384b..f58ccc05bd 100644 --- a/src/org/thoughtcrime/securesms/components/HourglassView.java +++ b/src/org/thoughtcrime/securesms/components/HourglassView.java @@ -61,10 +61,7 @@ public class HourglassView extends View { this.progressPaint.setColor(getResources().getColor(R.color.black)); this.progressPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); - if (android.os.Build.VERSION.SDK_INT >= 11) - { - setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } + setLayerType(View.LAYER_TYPE_SOFTWARE, null); } @Override diff --git a/src/org/thoughtcrime/securesms/components/InputPanel.java b/src/org/thoughtcrime/securesms/components/InputPanel.java index 017fddfbf9..7752c4f937 100644 --- a/src/org/thoughtcrime/securesms/components/InputPanel.java +++ b/src/org/thoughtcrime/securesms/components/InputPanel.java @@ -98,11 +98,6 @@ public class InputPanel extends LinearLayout this.microphoneRecorderView = findViewById(R.id.recorder_view); this.microphoneRecorderView.setListener(this); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - this.microphoneRecorderView.setVisibility(View.GONE); - this.microphoneRecorderView.setClickable(false); - } - if (TextSecurePreferences.isSystemEmojiPreferred(getContext())) { emojiToggle.setVisibility(View.GONE); emojiVisible = false; diff --git a/src/org/thoughtcrime/securesms/components/LinkPreviewView.java b/src/org/thoughtcrime/securesms/components/LinkPreviewView.java index befbe904ec..7240784802 100644 --- a/src/org/thoughtcrime/securesms/components/LinkPreviewView.java +++ b/src/org/thoughtcrime/securesms/components/LinkPreviewView.java @@ -88,25 +88,12 @@ public class LinkPreviewView extends FrameLayout { setWillNotDraw(false); } - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (type == TYPE_COMPOSE) return; - - if (cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } - } - @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (type == TYPE_COMPOSE) return; - if (!cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } - + cornerMask.mask(canvas); outliner.draw(canvas); } diff --git a/src/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java b/src/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java index d01cfb32b7..861587c83d 100644 --- a/src/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java +++ b/src/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java @@ -65,23 +65,11 @@ public class OutlinedThumbnailView extends ThumbnailView { setWillNotDraw(false); } - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - - if (cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } - } - @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); - if (!cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } - + cornerMask.mask(canvas); outliner.draw(canvas); } diff --git a/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java b/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java index 062a7bed72..f78019d8bb 100644 --- a/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java +++ b/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java @@ -86,9 +86,7 @@ public class PushRecipientsPanel extends RelativeLayout implements RecipientModi inflater.inflate(R.layout.push_recipients_panel, this, true); View imageButton = findViewById(R.id.contacts_button); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) - ((MarginLayoutParams) imageButton.getLayoutParams()).topMargin = 0; + ((MarginLayoutParams) imageButton.getLayoutParams()).topMargin = 0; panel = findViewById(R.id.recipients_panel); initRecipientsEditor(); diff --git a/src/org/thoughtcrime/securesms/components/QuoteView.java b/src/org/thoughtcrime/securesms/components/QuoteView.java index dc6eba85fc..afa16babb6 100644 --- a/src/org/thoughtcrime/securesms/components/QuoteView.java +++ b/src/org/thoughtcrime/securesms/components/QuoteView.java @@ -129,26 +129,12 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener } dismissView.setOnClickListener(view -> setVisibility(GONE)); - - if (cornerMask.isLegacy()) { - setWillNotDraw(false); - } - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); - if (!cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } + cornerMask.mask(canvas); } public void setQuote(GlideRequests glideRequests, diff --git a/src/org/thoughtcrime/securesms/components/RecentPhotoViewRail.java b/src/org/thoughtcrime/securesms/components/RecentPhotoViewRail.java index cc218929e7..87721de484 100644 --- a/src/org/thoughtcrime/securesms/components/RecentPhotoViewRail.java +++ b/src/org/thoughtcrime/securesms/components/RecentPhotoViewRail.java @@ -111,8 +111,8 @@ public class RecentPhotoViewRail extends FrameLayout implements LoaderManager.Lo String bucketId = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.BUCKET_ID)); int orientation = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION)); long size = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.SIZE)); - int width = Build.VERSION.SDK_INT >= 16 ? cursor.getInt(cursor.getColumnIndexOrThrow(getWidthColumn(orientation))) : 0; - int height = Build.VERSION.SDK_INT >= 16 ? cursor.getInt(cursor.getColumnIndexOrThrow(getHeightColumn(orientation))) : 0; + int width = cursor.getInt(cursor.getColumnIndexOrThrow(getWidthColumn(orientation))); + int height = cursor.getInt(cursor.getColumnIndexOrThrow(getHeightColumn(orientation))); final Uri uri = Uri.withAppendedPath(baseUri, Long.toString(id)); diff --git a/src/org/thoughtcrime/securesms/components/SharedContactView.java b/src/org/thoughtcrime/securesms/components/SharedContactView.java index 8d9beca377..7aa20a6c68 100644 --- a/src/org/thoughtcrime/securesms/components/SharedContactView.java +++ b/src/org/thoughtcrime/securesms/components/SharedContactView.java @@ -101,26 +101,12 @@ public class SharedContactView extends LinearLayout implements RecipientModified footer.setIconColor(iconColor); footer.setAlpha(footerAlpha); } - - if (cornerMask.isLegacy()) { - setWillNotDraw(false); - } - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); - if (!cornerMask.isLegacy()) { - cornerMask.mask(canvas); - } + cornerMask.mask(canvas); } public void setContact(@NonNull Contact contact, @NonNull GlideRequests glideRequests, @NonNull Locale locale) { diff --git a/src/org/thoughtcrime/securesms/components/reminder/UnsupportedAndroidVersionReminder.java b/src/org/thoughtcrime/securesms/components/reminder/UnsupportedAndroidVersionReminder.java deleted file mode 100644 index 7f94ff2428..0000000000 --- a/src/org/thoughtcrime/securesms/components/reminder/UnsupportedAndroidVersionReminder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.thoughtcrime.securesms.components.reminder; - -import android.content.Context; -import android.os.Build; -import android.support.annotation.NonNull; - -import org.thoughtcrime.securesms.R; - -public class UnsupportedAndroidVersionReminder extends Reminder { - - public UnsupportedAndroidVersionReminder(@NonNull Context context) { - super(null, context.getString(R.string.reminder_header_the_latest_signal_features_wont_work)); - } - - @Override - public boolean isDismissable() { - return false; - } - - public static boolean isEligible() { - return Build.VERSION.SDK_INT < 19; - } -} diff --git a/src/org/thoughtcrime/securesms/components/webrtc/WebRtcCallControls.java b/src/org/thoughtcrime/securesms/components/webrtc/WebRtcCallControls.java index 7b091662b1..8c4556c011 100644 --- a/src/org/thoughtcrime/securesms/components/webrtc/WebRtcCallControls.java +++ b/src/org/thoughtcrime/securesms/components/webrtc/WebRtcCallControls.java @@ -186,7 +186,7 @@ public class WebRtcCallControls extends LinearLayout { } public void displayVideoTooltip(ViewGroup viewGroup) { - if (Build.VERSION.SDK_INT > 15 && videoMuteButton.getVisibility() == VISIBLE) { + if (videoMuteButton.getVisibility() == VISIBLE) { final ToolTipsManager toolTipsManager = new ToolTipsManager(); ToolTip toolTip = new ToolTip.Builder(getContext(), videoMuteButton, viewGroup, diff --git a/src/org/thoughtcrime/securesms/contactshare/ContactNameEditViewModel.java b/src/org/thoughtcrime/securesms/contactshare/ContactNameEditViewModel.java index a453001f53..d902a1b23a 100644 --- a/src/org/thoughtcrime/securesms/contactshare/ContactNameEditViewModel.java +++ b/src/org/thoughtcrime/securesms/contactshare/ContactNameEditViewModel.java @@ -110,29 +110,24 @@ public class ContactNameEditViewModel extends ViewModel { Character.UnicodeBlock block = Character.UnicodeBlock.of(codepoint); - boolean isCJKV = Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS.equals(block) || - Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.equals(block) || - Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B.equals(block) || - Character.UnicodeBlock.CJK_COMPATIBILITY.equals(block) || - Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS.equals(block) || - Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS.equals(block) || - Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT.equals(block) || - Character.UnicodeBlock.CJK_RADICALS_SUPPLEMENT.equals(block) || - Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION.equals(block) || - Character.UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS.equals(block) || - Character.UnicodeBlock.KANGXI_RADICALS.equals(block) || - Character.UnicodeBlock.IDEOGRAPHIC_DESCRIPTION_CHARACTERS.equals(block) || - Character.UnicodeBlock.HIRAGANA.equals(block) || - Character.UnicodeBlock.KATAKANA.equals(block) || - Character.UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS.equals(block) || - Character.UnicodeBlock.HANGUL_JAMO.equals(block) || - Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO.equals(block) || - Character.UnicodeBlock.HANGUL_SYLLABLES.equals(block); - - if (Build.VERSION.SDK_INT >= 19) { - isCJKV |= Character.isIdeographic(codepoint); - } - - return isCJKV; + return Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS.equals(block) || + Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A.equals(block) || + Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B.equals(block) || + Character.UnicodeBlock.CJK_COMPATIBILITY.equals(block) || + Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS.equals(block) || + Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS.equals(block) || + Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT.equals(block) || + Character.UnicodeBlock.CJK_RADICALS_SUPPLEMENT.equals(block) || + Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION.equals(block) || + Character.UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS.equals(block) || + Character.UnicodeBlock.KANGXI_RADICALS.equals(block) || + Character.UnicodeBlock.IDEOGRAPHIC_DESCRIPTION_CHARACTERS.equals(block) || + Character.UnicodeBlock.HIRAGANA.equals(block) || + Character.UnicodeBlock.KATAKANA.equals(block) || + Character.UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS.equals(block) || + Character.UnicodeBlock.HANGUL_JAMO.equals(block) || + Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO.equals(block) || + Character.UnicodeBlock.HANGUL_SYLLABLES.equals(block) || + Character.isIdeographic(codepoint); } } diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 50a5798ee7..aa55c30779 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -1570,12 +1570,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity distributionType = getIntent().getIntExtra(DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT); glideRequests = GlideApp.with(this); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { - LinearLayout conversationContainer = ViewUtil.findById(this, R.id.conversation_container); - conversationContainer.setClipChildren(true); - conversationContainer.setClipToPadding(true); - } - recipient.addListener(this); } diff --git a/src/org/thoughtcrime/securesms/database/loaders/RecentPhotosLoader.java b/src/org/thoughtcrime/securesms/database/loaders/RecentPhotosLoader.java index e8e2adde67..e571beb016 100644 --- a/src/org/thoughtcrime/securesms/database/loaders/RecentPhotosLoader.java +++ b/src/org/thoughtcrime/securesms/database/loaders/RecentPhotosLoader.java @@ -5,7 +5,6 @@ import android.Manifest; import android.content.Context; import android.database.Cursor; import android.net.Uri; -import android.os.Build; import android.provider.MediaStore; import android.support.v4.content.CursorLoader; @@ -16,16 +15,6 @@ public class RecentPhotosLoader extends CursorLoader { public static Uri BASE_URL = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; private static final String[] PROJECTION = new String[] { - MediaStore.Images.ImageColumns._ID, - MediaStore.Images.ImageColumns.DATE_TAKEN, - MediaStore.Images.ImageColumns.DATE_MODIFIED, - MediaStore.Images.ImageColumns.ORIENTATION, - MediaStore.Images.ImageColumns.MIME_TYPE, - MediaStore.Images.ImageColumns.BUCKET_ID, - MediaStore.Images.ImageColumns.SIZE - }; - - private static final String[] PROJECTION_16 = new String[] { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATE_TAKEN, MediaStore.Images.ImageColumns.DATE_MODIFIED, @@ -46,11 +35,9 @@ public class RecentPhotosLoader extends CursorLoader { @Override public Cursor loadInBackground() { - String[] projection = Build.VERSION.SDK_INT >= 16 ? PROJECTION_16 : PROJECTION; - if (Permissions.hasAll(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { return context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, - projection, null, null, + PROJECTION, null, null, MediaStore.Images.ImageColumns.DATE_MODIFIED + " DESC"); } else { return null; diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index 6fb7e6d488..2ed85cfabf 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -252,24 +252,22 @@ public class MultiDeviceContactUpdateJob extends ContextJob implements Injectabl return Optional.absent(); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - Uri displayPhotoUri = Uri.withAppendedPath(uri, ContactsContract.Contacts.Photo.DISPLAY_PHOTO); + Uri displayPhotoUri = Uri.withAppendedPath(uri, ContactsContract.Contacts.Photo.DISPLAY_PHOTO); - try { - AssetFileDescriptor fd = context.getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r"); + try { + AssetFileDescriptor fd = context.getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r"); - if (fd == null) { - return Optional.absent(); - } - - return Optional.of(SignalServiceAttachment.newStreamBuilder() - .withStream(fd.createInputStream()) - .withContentType("image/*") - .withLength(fd.getLength()) - .build()); - } catch (IOException e) { - Log.i(TAG, "Could not find avatar for URI: " + displayPhotoUri); + if (fd == null) { + return Optional.absent(); } + + return Optional.of(SignalServiceAttachment.newStreamBuilder() + .withStream(fd.createInputStream()) + .withContentType("image/*") + .withLength(fd.getLength()) + .build()); + } catch (IOException e) { + Log.i(TAG, "Could not find avatar for URI: " + displayPhotoUri); } Uri photoUri = Uri.withAppendedPath(uri, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); diff --git a/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java b/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java index a22ba78920..2e07392f1f 100644 --- a/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java +++ b/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java @@ -160,10 +160,7 @@ public class UpdateApkJob extends ContextJob { downloadRequest.setDescription("Downloading Signal " + versionName); downloadRequest.setVisibleInDownloadsUi(false); downloadRequest.setDestinationInExternalFilesDir(context, null, "signal-update.apk"); - - if (Build.VERSION.SDK_INT >= 11) { - downloadRequest.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); - } + downloadRequest.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN); long downloadId = downloadManager.enqueue(downloadRequest); TextSecurePreferences.setUpdateApkDownloadId(context, downloadId); diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaRepository.java b/src/org/thoughtcrime/securesms/mediasend/MediaRepository.java index e095223073..8d32234be1 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaRepository.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaRepository.java @@ -168,11 +168,9 @@ class MediaRepository { String[] projection; if (hasOrienation) { - projection = Build.VERSION.SDK_INT >= 16 ? new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.ORIENTATION, Images.Media.WIDTH, Images.Media.HEIGHT, Images.Media.SIZE} - : new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.ORIENTATION, Images.Media.SIZE}; + projection = new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.ORIENTATION, Images.Media.WIDTH, Images.Media.HEIGHT, Images.Media.SIZE}; } else { - projection = Build.VERSION.SDK_INT >= 16 ? new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.WIDTH, Images.Media.HEIGHT, Images.Media.SIZE} - : new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.SIZE}; + projection = new String[]{Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.WIDTH, Images.Media.HEIGHT, Images.Media.SIZE}; } if (Media.ALL_MEDIA_BUCKET_ID.equals(bucketId)) { @@ -186,15 +184,10 @@ class MediaRepository { String mimetype = cursor.getString(cursor.getColumnIndexOrThrow(Images.Media.MIME_TYPE)); long dateTaken = cursor.getLong(cursor.getColumnIndexOrThrow(Images.Media.DATE_TAKEN)); int orientation = hasOrienation ? cursor.getInt(cursor.getColumnIndexOrThrow(Images.Media.ORIENTATION)) : 0; - int width = 0; - int height = 0; + int width = cursor.getInt(cursor.getColumnIndexOrThrow(getWidthColumn(orientation))); + int height = cursor.getInt(cursor.getColumnIndexOrThrow(getHeightColumn(orientation))); long size = cursor.getLong(cursor.getColumnIndexOrThrow(Images.Media.SIZE)); - if (Build.VERSION.SDK_INT >= 16) { - width = cursor.getInt(cursor.getColumnIndexOrThrow(getWidthColumn(orientation))); - height = cursor.getInt(cursor.getColumnIndexOrThrow(getHeightColumn(orientation))); - } - media.add(new Media(uri, mimetype, dateTaken, width, height, size, Optional.of(bucketId), Optional.absent())); } } diff --git a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java index a24810f157..140b079c18 100644 --- a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java +++ b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java @@ -468,18 +468,16 @@ public class AttachmentManager { final Intent intent = new Intent(); intent.setType(type); - if (extraMimeType != null && Build.VERSION.SDK_INT >= 19) { + if (extraMimeType != null) { intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeType); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - intent.setAction(Intent.ACTION_OPEN_DOCUMENT); - try { - activity.startActivityForResult(intent, requestCode); - return; - } catch (ActivityNotFoundException anfe) { - Log.w(TAG, "couldn't complete ACTION_OPEN_DOCUMENT, no activity found. falling back."); - } + intent.setAction(Intent.ACTION_OPEN_DOCUMENT); + try { + activity.startActivityForResult(intent, requestCode); + return; + } catch (ActivityNotFoundException anfe) { + Log.w(TAG, "couldn't complete ACTION_OPEN_DOCUMENT, no activity found. falling back."); } intent.setAction(Intent.ACTION_GET_CONTENT); diff --git a/src/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java b/src/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java index db5ef29d08..702d70015c 100644 --- a/src/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java +++ b/src/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java @@ -220,7 +220,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil } private boolean hasBigPictureSlide(@Nullable SlideDeck slideDeck) { - if (slideDeck == null || Build.VERSION.SDK_INT < 16) { + if (slideDeck == null) { return false; } diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java index a394692f99..90eea15b4d 100644 --- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java @@ -117,7 +117,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment findPreference(TextSecurePreferences.PASSPHRASE_TIMEOUT_PREF).setVisible(false); KeyguardManager keyguardManager = (KeyguardManager)getContext().getSystemService(Context.KEYGUARD_SERVICE); - if (Build.VERSION.SDK_INT < 16 || !keyguardManager.isKeyguardSecure()) { + if (!keyguardManager.isKeyguardSecure()) { ((SwitchPreferenceCompat)findPreference(TextSecurePreferences.SCREEN_LOCK)).setChecked(false); findPreference(TextSecurePreferences.SCREEN_LOCK).setEnabled(false); } diff --git a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java index 6de3adde73..bf1f7b5256 100644 --- a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java @@ -112,14 +112,8 @@ public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment { boolean postKitkatSMS = Util.isDefaultSmsProvider(context); boolean preKitkatSMS = TextSecurePreferences.isInterceptAllSmsEnabled(context); boolean preKitkatMMS = TextSecurePreferences.isInterceptAllMmsEnabled(context); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - if (postKitkatSMS) return onCaps; - else return offCaps; - } else { - if (preKitkatSMS && preKitkatMMS) return onCaps; - else if (preKitkatSMS && !preKitkatMMS) return context.getString(smsMmsSummaryResId, on, off); - else if (!preKitkatSMS && preKitkatMMS) return context.getString(smsMmsSummaryResId, off, on); - else return offCaps; - } + + if (postKitkatSMS) return onCaps; + else return offCaps; } } diff --git a/src/org/thoughtcrime/securesms/profiles/SystemProfileUtil.java b/src/org/thoughtcrime/securesms/profiles/SystemProfileUtil.java index 1e4c08c534..723034ed4b 100644 --- a/src/org/thoughtcrime/securesms/profiles/SystemProfileUtil.java +++ b/src/org/thoughtcrime/securesms/profiles/SystemProfileUtil.java @@ -32,23 +32,21 @@ public class SystemProfileUtil { new AsyncTask() { @Override protected @Nullable byte[] doInBackground(Void... params) { - if (Build.VERSION.SDK_INT >= 14) { - try (Cursor cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null)) { - while (cursor != null && cursor.moveToNext()) { - String photoUri = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Profile.PHOTO_URI)); + try (Cursor cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null)) { + while (cursor != null && cursor.moveToNext()) { + String photoUri = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Profile.PHOTO_URI)); - if (!TextUtils.isEmpty(photoUri)) { - try { - BitmapUtil.ScaleResult result = BitmapUtil.createScaledBytes(context, Uri.parse(photoUri), mediaConstraints); - return result.getBitmap(); - } catch (BitmapDecodingException e) { - Log.w(TAG, e); - } + if (!TextUtils.isEmpty(photoUri)) { + try { + BitmapUtil.ScaleResult result = BitmapUtil.createScaledBytes(context, Uri.parse(photoUri), mediaConstraints); + return result.getBitmap(); + } catch (BitmapDecodingException e) { + Log.w(TAG, e); } } - } catch (SecurityException se) { - Log.w(TAG, se); } + } catch (SecurityException se) { + Log.w(TAG, se); } return null; @@ -73,14 +71,12 @@ public class SystemProfileUtil { protected String doInBackground(Void... params) { String name = null; - if (Build.VERSION.SDK_INT >= 14) { - try (Cursor cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null)) { - if (cursor != null && cursor.moveToNext()) { - name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Profile.DISPLAY_NAME)); - } - } catch (SecurityException se) { - Log.w(TAG, se); + try (Cursor cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, null, null, null, null)) { + if (cursor != null && cursor.moveToNext()) { + name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Profile.DISPLAY_NAME)); } + } catch (SecurityException se) { + Log.w(TAG, se); } if (name == null) { diff --git a/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java b/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java index f12063c125..593f1e6bec 100644 --- a/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java +++ b/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java @@ -38,10 +38,8 @@ public class ScribbleActivity extends PassphraseRequiredActionBarActivity implem getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment).commit(); } - if (Build.VERSION.SDK_INT >= 19) { - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); - } + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } @Override diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java index 9fbbb94d7c..1dcbb8347b 100644 --- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -250,8 +250,12 @@ public class KeyCachingService extends Service { } } - @TargetApi(Build.VERSION_CODES.JELLY_BEAN) - private void foregroundServiceModern() { + private void foregroundService() { + if (TextSecurePreferences.isPasswordDisabled(this) && !TextSecurePreferences.isScreenLockEnabled(this)) { + stopForeground(true); + return; + } + Log.i(TAG, "foregrounding KCS"); NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NotificationChannels.LOCKED_STATUS); @@ -268,48 +272,6 @@ public class KeyCachingService extends Service { startForeground(SERVICE_RUNNING_ID, builder.build()); } - private void foregroundServiceICS() { - NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NotificationChannels.LOCKED_STATUS); - RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification); - - remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, buildLockIntent()); - - builder.setSmallIcon(R.drawable.icon_cached); - builder.setContent(remoteViews); - builder.setContentIntent(buildLaunchIntent()); - - stopForeground(true); - startForeground(SERVICE_RUNNING_ID, builder.build()); - } - - private void foregroundServiceLegacy() { - NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NotificationChannels.LOCKED_STATUS); - builder.setSmallIcon(R.drawable.icon_cached); - builder.setWhen(System.currentTimeMillis()); - - builder.setContentTitle(getString(R.string.KeyCachingService_passphrase_cached)); - builder.setContentText(getString(R.string.KeyCachingService_signal_passphrase_cached)); - builder.setContentIntent(buildLaunchIntent()); - - stopForeground(true); - startForeground(SERVICE_RUNNING_ID, builder.build()); - } - - private void foregroundService() { - if (TextSecurePreferences.isPasswordDisabled(this) && !TextSecurePreferences.isScreenLockEnabled(this)) { - stopForeground(true); - return; - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - foregroundServiceModern(); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - foregroundServiceICS(); - } else { - foregroundServiceLegacy(); - } - } - private void broadcastNewSecret() { Log.i(TAG, "Broadcasting new secret..."); diff --git a/src/org/thoughtcrime/securesms/service/MmsListener.java b/src/org/thoughtcrime/securesms/service/MmsListener.java index 397a151e21..09d9797cb5 100644 --- a/src/org/thoughtcrime/securesms/service/MmsListener.java +++ b/src/org/thoughtcrime/securesms/service/MmsListener.java @@ -37,19 +37,10 @@ public class MmsListener extends BroadcastReceiver { return false; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && - Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction()) && - Util.isDefaultSmsProvider(context)) - { + if (Telephony.Sms.Intents.WAP_PUSH_RECEIVED_ACTION.equals(intent.getAction()) && Util.isDefaultSmsProvider(context)) { return false; } - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && - TextSecurePreferences.isInterceptAllMmsEnabled(context)) - { - return true; - } - return false; } diff --git a/src/org/thoughtcrime/securesms/service/SmsListener.java b/src/org/thoughtcrime/securesms/service/SmsListener.java index 7010de4fb1..67bf62c453 100644 --- a/src/org/thoughtcrime/securesms/service/SmsListener.java +++ b/src/org/thoughtcrime/securesms/service/SmsListener.java @@ -89,19 +89,10 @@ public class SmsListener extends BroadcastReceiver { if (!ApplicationMigrationService.isDatabaseImported(context)) return false; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && - SMS_RECEIVED_ACTION.equals(intent.getAction()) && - Util.isDefaultSmsProvider(context)) - { + if (SMS_RECEIVED_ACTION.equals(intent.getAction()) && Util.isDefaultSmsProvider(context)) { return false; } - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && - TextSecurePreferences.isInterceptAllSmsEnabled(context)) - { - return true; - } - return false; } diff --git a/src/org/thoughtcrime/securesms/util/DateUtils.java b/src/org/thoughtcrime/securesms/util/DateUtils.java index d85031bd4a..b60a927aeb 100644 --- a/src/org/thoughtcrime/securesms/util/DateUtils.java +++ b/src/org/thoughtcrime/securesms/util/DateUtils.java @@ -141,10 +141,6 @@ public class DateUtils extends android.text.format.DateUtils { } private static String getLocalizedPattern(String template, Locale locale) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - return DateFormat.getBestDateTimePattern(locale, template); - } else { - return new SimpleDateFormat(template, locale).toLocalizedPattern(); - } + return DateFormat.getBestDateTimePattern(locale, template); } } diff --git a/src/org/thoughtcrime/securesms/util/MemoryFileUtil.java b/src/org/thoughtcrime/securesms/util/MemoryFileUtil.java index 06a4cecd1e..3c67478da5 100644 --- a/src/org/thoughtcrime/securesms/util/MemoryFileUtil.java +++ b/src/org/thoughtcrime/securesms/util/MemoryFileUtil.java @@ -23,11 +23,7 @@ public class MemoryFileUtil { int fd = field.getInt(fileDescriptor); - if (Build.VERSION.SDK_INT >= 13) { - return ParcelFileDescriptor.adoptFd(fd); - } else { - return ParcelFileDescriptor.dup(fileDescriptor); - } + return ParcelFileDescriptor.adoptFd(fd); } catch (IllegalAccessException e) { throw new IOException(e); } catch (InvocationTargetException e) { diff --git a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java index 34dca9038c..c8a015446e 100644 --- a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java +++ b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java @@ -530,11 +530,7 @@ public class TextSecurePreferences { } public static boolean isSmsEnabled(Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - return Util.isDefaultSmsProvider(context); - } else { - return isInterceptAllSmsEnabled(context); - } + return Util.isDefaultSmsProvider(context); } public static int getLocalRegistrationId(Context context) { diff --git a/src/org/thoughtcrime/securesms/util/Util.java b/src/org/thoughtcrime/securesms/util/Util.java index 2edcc15b36..a95a8ae081 100644 --- a/src/org/thoughtcrime/securesms/util/Util.java +++ b/src/org/thoughtcrime/securesms/util/Util.java @@ -367,8 +367,7 @@ public class Util { @SuppressLint("NewApi") public static boolean isDefaultSmsProvider(Context context){ - return (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) || - (context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context))); + return context.getPackageName().equals(Telephony.Sms.getDefaultSmsPackage(context)); } public static int getCurrentApkReleaseVersion(Context context) { @@ -395,12 +394,8 @@ public class Util { } public static int getDaysTillBuildExpiry() { - if (Build.VERSION.SDK_INT < 19) { - return Integer.MAX_VALUE; - } else { - int age = (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP); - return 90 - age; - } + int age = (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - BuildConfig.BUILD_TIMESTAMP); + return 90 - age; } @TargetApi(VERSION_CODES.LOLLIPOP) diff --git a/src/org/thoughtcrime/securesms/webrtc/audio/BluetoothStateManager.java b/src/org/thoughtcrime/securesms/webrtc/audio/BluetoothStateManager.java index e2a90048c3..93c9858f28 100644 --- a/src/org/thoughtcrime/securesms/webrtc/audio/BluetoothStateManager.java +++ b/src/org/thoughtcrime/securesms/webrtc/audio/BluetoothStateManager.java @@ -129,11 +129,7 @@ public class BluetoothStateManager { } private String getScoChangeIntent() { - if (Build.VERSION.SDK_INT >= 14) { - return AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED; - } else { - return AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED; - } + return AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED; } diff --git a/src/org/thoughtcrime/securesms/webrtc/audio/IncomingRinger.java b/src/org/thoughtcrime/securesms/webrtc/audio/IncomingRinger.java index a88683c0cb..e1c96b605f 100644 --- a/src/org/thoughtcrime/securesms/webrtc/audio/IncomingRinger.java +++ b/src/org/thoughtcrime/securesms/webrtc/audio/IncomingRinger.java @@ -79,11 +79,7 @@ public class IncomingRinger { return true; } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - return shouldVibrateNew(context, ringerMode, vibrate); - } else { - return shouldVibrateOld(context, vibrate); - } + return shouldVibrateNew(context, ringerMode, vibrate); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) diff --git a/src/org/thoughtcrime/securesms/webrtc/audio/SignalAudioManager.java b/src/org/thoughtcrime/securesms/webrtc/audio/SignalAudioManager.java index 1dead5caf0..570d0f0a6e 100644 --- a/src/org/thoughtcrime/securesms/webrtc/audio/SignalAudioManager.java +++ b/src/org/thoughtcrime/securesms/webrtc/audio/SignalAudioManager.java @@ -37,12 +37,7 @@ public class SignalAudioManager { public void initializeAudioForCall() { AudioManager audioManager = ServiceUtil.getAudioManager(context); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - audioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE); - } else { - audioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); - } + audioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE); } public void startIncomingRinger(@Nullable Uri ringtoneUri, boolean vibrate) {