mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Remove unnecessary pre-19 code branches.
Now that our minSdk is 19, we can remove a lot of old code paths that only ran pre-19.
This commit is contained in:
parent
a52c295a38
commit
8caaf057e8
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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<Integer>() {
|
||||
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
|
||||
return Math.round(startValue + (endValue - startValue) * fraction);
|
||||
}
|
||||
});
|
||||
valueAnimator.setEvaluator(new TypeEvaluator<Integer>() {
|
||||
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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -32,23 +32,21 @@ public class SystemProfileUtil {
|
||||
new AsyncTask<Void, Void, byte[]>() {
|
||||
@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) {
|
||||
|
@ -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
|
||||
|
@ -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...");
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user