2015-07-07 21:25:41 +00:00
|
|
|
package org.thoughtcrime.securesms.util;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
2017-11-27 20:18:14 +00:00
|
|
|
import android.app.AlarmManager;
|
2015-09-29 20:14:22 +00:00
|
|
|
import android.app.NotificationManager;
|
2015-07-07 21:25:41 +00:00
|
|
|
import android.content.Context;
|
2015-11-04 18:42:19 +00:00
|
|
|
import android.media.AudioManager;
|
2015-08-24 22:24:31 +00:00
|
|
|
import android.net.ConnectivityManager;
|
2019-04-19 15:36:00 +00:00
|
|
|
import android.os.Build;
|
2017-03-26 14:55:43 +00:00
|
|
|
import android.os.PowerManager;
|
2017-12-05 19:52:03 +00:00
|
|
|
import android.os.Vibrator;
|
2020-08-19 00:06:26 +00:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.annotation.RequiresApi;
|
2019-04-19 15:36:00 +00:00
|
|
|
import android.telephony.SubscriptionManager;
|
2015-10-28 17:24:55 +00:00
|
|
|
import android.telephony.TelephonyManager;
|
2015-07-07 21:25:41 +00:00
|
|
|
import android.view.WindowManager;
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
|
|
|
|
public class ServiceUtil {
|
|
|
|
public static InputMethodManager getInputMethodManager(Context context) {
|
|
|
|
return (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static WindowManager getWindowManager(Context context) {
|
|
|
|
return (WindowManager) context.getSystemService(Activity.WINDOW_SERVICE);
|
|
|
|
}
|
2015-08-24 22:24:31 +00:00
|
|
|
|
|
|
|
public static ConnectivityManager getConnectivityManager(Context context) {
|
|
|
|
return (ConnectivityManager) context.getSystemService(Activity.CONNECTIVITY_SERVICE);
|
|
|
|
}
|
2015-09-29 20:14:22 +00:00
|
|
|
|
|
|
|
public static NotificationManager getNotificationManager(Context context) {
|
|
|
|
return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
|
}
|
2015-10-28 17:24:55 +00:00
|
|
|
|
|
|
|
public static TelephonyManager getTelephonyManager(Context context) {
|
|
|
|
return (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
|
|
|
|
}
|
2015-11-04 18:42:19 +00:00
|
|
|
|
|
|
|
public static AudioManager getAudioManager(Context context) {
|
|
|
|
return (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
|
|
|
|
}
|
2017-03-26 14:55:43 +00:00
|
|
|
|
|
|
|
public static PowerManager getPowerManager(Context context) {
|
|
|
|
return (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
|
|
|
}
|
2017-11-27 20:18:14 +00:00
|
|
|
|
|
|
|
public static AlarmManager getAlarmManager(Context context) {
|
|
|
|
return (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
|
|
|
|
}
|
2017-12-05 19:52:03 +00:00
|
|
|
|
|
|
|
public static Vibrator getVibrator(Context context) {
|
|
|
|
return (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
|
}
|
2019-04-19 15:36:00 +00:00
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
|
2019-05-01 15:36:24 +00:00
|
|
|
public static @Nullable SubscriptionManager getSubscriptionManager(@NonNull Context context) {
|
2019-05-23 14:38:24 +00:00
|
|
|
return (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
2019-04-19 15:36:00 +00:00
|
|
|
}
|
2015-07-07 21:25:41 +00:00
|
|
|
}
|