本文整理汇总了Java中android.os.SystemProperties.get方法的典型用法代码示例。如果您正苦于以下问题:Java SystemProperties.get方法的具体用法?Java SystemProperties.get怎么用?Java SystemProperties.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.SystemProperties
的用法示例。
在下文中一共展示了SystemProperties.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openMiuiPermissionActivity
import android.os.SystemProperties; //导入方法依赖的package包/类
/**
* 打开MIUI权限管理界面(MIUI v5, v6)
* @param context
*/
public static void openMiuiPermissionActivity(Context context) {
Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR");
String rom = SystemProperties.get("ro.miui.ui.version.name", "unkonw");
if ("V5".equals(rom)) {
openAppDetailActivity(context, context.getPackageName());
} else if ("V6".equals(rom)) {
intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
intent.putExtra("extra_pkgname", context.getPackageName());
}
if (isIntentAvailable(context, intent)) {
if (context instanceof Activity) {
Activity a = (Activity) context;
a.startActivityForResult(intent, 2);
}
} else {
}
}
示例2: getProductName
import android.os.SystemProperties; //导入方法依赖的package包/类
public static String getProductName() {
if (!TextUtils.isEmpty(sProductName)) {
return sProductName;
}
try {
sProductName = SystemProperties.get(PROPERTY_PRODUCT_NAME, "");
if (TextUtils.isEmpty(sProductName)) {
sProductName = SystemProperties.get("persist.product.letv.name", "");
}
} catch (Exception e) {
} catch (Error e2) {
}
if (TextUtils.isEmpty(sProductName)) {
if (Build.MODEL.toUpperCase().contains(Build.BRAND.toUpperCase())) {
sProductName = Build.MODEL;
} else {
sProductName = Build.BRAND + " " + Build.MODEL;
}
} else if (isLetv()) {
sProductName = "LETV " + sProductName;
}
sProductName = sProductName.toUpperCase();
return sProductName;
}
示例3: publishFirmwareBuildDate
import android.os.SystemProperties; //导入方法依赖的package包/类
private void publishFirmwareBuildDate() {
String buildDate;
JSONObject result = new JSONObject();
buildDate = SystemProperties.get(BUILD_DATE_UTC_PROPERTY);
try {
result.put("buildDate", buildDate);
CommonUtils.sendBroadcast(context, Constants.Operation.GET_FIRMWARE_BUILD_DATE, Constants.Code.SUCCESS, Constants.Status.SUCCESSFUL,
result.toString());
} catch (JSONException e) {
String error = "Failed to create JSON object when publishing OTA progress.";
Log.e(TAG, error, e);
CommonUtils.sendBroadcast(context, Constants.Operation.GET_FIRMWARE_BUILD_DATE, Constants.Code.FAILURE, Constants.Status.INTERNAL_ERROR,
String.valueOf(DEFAULT_STATE_INFO_CODE));
}
}
示例4: createBaseContextForActivity
import android.os.SystemProperties; //导入方法依赖的package包/类
private Context createBaseContextForActivity(ActivityClientRecord r,
final Activity activity) {
ContextImpl appContext = new ContextImpl();
appContext.init(r.packageInfo, r.token, this);
appContext.setOuterContext(activity);
// For debugging purposes, if the activity's package name contains the value of
// the "debug.use-second-display" system property as a substring, then show
// its content on a secondary display if there is one.
Context baseContext = appContext;
String pkgName = SystemProperties.get("debug.second-display.pkg");
if (pkgName != null && !pkgName.isEmpty()
&& r.packageInfo.mPackageName.contains(pkgName)) {
DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance();
for (int displayId : dm.getDisplayIds()) {
if (displayId != Display.DEFAULT_DISPLAY) {
Display display = dm.getRealDisplay(displayId, r.token);
baseContext = appContext.createDisplayContext(display);
break;
}
}
}
return baseContext;
}
示例5: getLetvRomVersion
import android.os.SystemProperties; //导入方法依赖的package包/类
public static String getLetvRomVersion() {
return SystemProperties.get(PROPERTY_RELEASE_VERSION, "");
}
示例6: getAdbPort
import android.os.SystemProperties; //导入方法依赖的package包/类
public static int getAdbPort() {
// XXX: SystemProperties.get is @hide method
String port = SystemProperties.get("service.adb.tcp.port", "");
UILog.i("service.adb.tcp.port: " + port);
if (!TextUtils.isEmpty(port) && TextUtils.isDigitsOnly(port)) {
int p = Integer.parseInt(port);
if (p > 0 && p <= 0xffff) {
return p;
}
}
return -1;
}
示例7: isMiuiV5
import android.os.SystemProperties; //导入方法依赖的package包/类
public static boolean isMiuiV5() {
boolean result = false;
String ver = SystemProperties.get("ro.miui.ui.version.name", "unkonw");
if (ver.equals("V5") || ver.equals("V6")) {
if (hasAddWindowManager()) {
result = true;
}
}
return result;
}
示例8: openMiuiAutostartActivity
import android.os.SystemProperties; //导入方法依赖的package包/类
public static void openMiuiAutostartActivity(Context context) {
Intent intent = new Intent();
String rom = SystemProperties.get("ro.miui.ui.version.name", "unkonw");
if("V5".equals(rom)) {
// TODO 王天成自启动管理界面 V5
} else if("V6".equals(rom)) {
intent.setClassName("com.miui.permcenter", "com.miui.permcenter.autostart.AutoStartManagementActivity");
if(isIntentAvailable(context, intent)) {
context.startActivity(intent);
}
}
}
示例9: isRoaming
import android.os.SystemProperties; //导入方法依赖的package包/类
static boolean isRoaming() {
// TODO: fix and put in Telephony layer
String roaming = SystemProperties.get(
TelephonyProperties.PROPERTY_OPERATOR_ISROAMING, null);
if (LOCAL_LOGV) {
Log.v(TAG, "roaming ------> " + roaming);
}
return "true".equals(roaming);
}
示例10: onResume
import android.os.SystemProperties; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
String sn = SystemProperties.get("gsm.serial", null);
mCalibrationState = State.UNKNOWN;
mComprehensiveTestState = State.UNKNOWN;
if (!TextUtils.isEmpty(sn)) {
if (sn.length() >= 63) {
String calibration = sn.substring(60, 62);
char comprehensiveTest = sn.charAt(62);
Log.d(this, "onResume=>calibration: " + calibration + " comprehensiveTest: " + comprehensiveTest);
if ("10".equals(calibration)) {
mCalibrationState = State.PASS;
} else if ("01".equals(calibration)) {
mCalibrationState = State.FAIL;
}
if ('P' == comprehensiveTest) {
mComprehensiveTestState = State.PASS;
} else if ('F' == comprehensiveTest) {
mComprehensiveTestState = State.FAIL;
}
} else {
mCalibrationState = State.FAIL;
mComprehensiveTestState = State.FAIL;
}
}
Log.d(this, "onResume=>sn: " + sn + " calibration state: " + mCalibrationState + " comprehensive test state: " + mComprehensiveTestState);
if (TextUtils.isEmpty(sn)) {
mSNTv.setTextColor(getResources().getColor(R.color.orange));
mSNTv.setText(R.string.unknown);
} else {
mSNTv.setTextColor(mDefaultTextColor);
mSNTv.setText(sn);
}
switch (mCalibrationState) {
case UNKNOWN:
mCalibrationTv.setTextColor(getResources().getColor(R.color.orange));
mCalibrationTv.setText(R.string.unknown);
break;
case FAIL:
mCalibrationTv.setTextColor(getResources().getColor(R.color.red));
mCalibrationTv.setText(R.string.fail);
break;
case PASS:
mCalibrationTv.setTextColor(getResources().getColor(R.color.green));
mCalibrationTv.setText(R.string.pass);
break;
}
switch (mComprehensiveTestState) {
case UNKNOWN:
mComprehensiveTestTv.setTextColor(getResources().getColor(R.color.orange));
mComprehensiveTestTv.setText(R.string.unknown);
break;
case FAIL:
mComprehensiveTestTv.setTextColor(getResources().getColor(R.color.red));
mComprehensiveTestTv.setText(R.string.fail);
break;
case PASS:
mComprehensiveTestTv.setTextColor(getResources().getColor(R.color.green));
mComprehensiveTestTv.setText(R.string.pass);
break;
}
if (mIsAutoTest) {
if (!TextUtils.isEmpty(sn) && mCalibrationState == State.PASS && mComprehensiveTestState == State.PASS) {
mHandler.sendEmptyMessageDelayed(MSG_PASS, mAutoTestDelayTime);
} else {
mHandler.sendEmptyMessageDelayed(MSG_FAIL, mAutoTestDelayTime);
}
}
}
示例11: isMiui
import android.os.SystemProperties; //导入方法依赖的package包/类
public static boolean isMiui() {
try {
String s = Build.DISPLAY;
if (s != null) {
if (s.toUpperCase().contains("MIUI")) {
return true;
}
}
s = Build.MODEL; // 小米
if (s != null) {
if (s.contains("MI-ONE")) {
return true;
}
}
s = Build.DEVICE;
if (s != null) {
if (s.contains("mione")) {
return true;
}
}
s = Build.MANUFACTURER;
if (s != null) {
if (s.equalsIgnoreCase("Xiaomi")) {
return true;
}
}
s = Build.PRODUCT;
if (s != null) {
if (s.contains("mione")) {
return true;
}
}
String ver = SystemProperties.get("ro.miui.ui.version.name",
"unkonw");
if ("V5".equals(ver) || "V6".equals(ver)) {
return true;
}
} catch (Exception e) {
return false;
}
return false;
}
示例12: hasAddWindowManager
import android.os.SystemProperties; //导入方法依赖的package包/类
/**
* 是否添加了浮动框管理
*
* @return
*/
public static boolean hasAddWindowManager() {
boolean result = true;
try {
String ver = SystemProperties.get("ro.build.version.incremental", "unkonw");
if (ver.startsWith("JLB")) {
if (Float.valueOf(ver.substring(3, ver.length())) < 22.0F) {
result = false;
}
} else if (ver.startsWith("JX")) {
result = true;
} else if (ver.startsWith("JH")) {
result = true;
} else if (ver.startsWith("JMA")) {
if (Float.valueOf(ver.substring(7, ver.length())) < 1.0F) {
result = false;
}
} else if (ver.startsWith("HBJ")) {
result = true;
} else if (ver.startsWith("KX")) {
result = true;
} else if (!ver.equals(ADD_WINDOWMANAGER_VER)) {
String[] nVer = ver.split("\\.");
String[] aVer = ADD_WINDOWMANAGER_VER.split("\\.");
if (nVer.length > aVer.length) {
result = true;
} else if (nVer.length > aVer.length) {
result = false;
} else {
for (int i = 0; i < nVer.length; i++) {
int n = Integer.valueOf(nVer[i]);
int a = Integer.valueOf(aVer[i]);
if (n > a) {
result = true;
break;
} else if (n < a) {
result = false;
break;
}
}
}
}
} catch (Exception e) {
result = false;
LogUtils.e(TAG, e);
}
return result;
}
示例13: getIccState
import android.os.SystemProperties; //导入方法依赖的package包/类
public static int getIccState(int i)
{
String s;
if (i == 10) {
if (HtcTelephonyManager.dualPhoneEnable()) {
if (HtcTelephonyManager.isDualGCPhone())
s = SystemProperties.get("gsm.icc.sim.state");
else
s = SystemProperties.get("gsm.icc.uim.state");
} else if (HtcTelephonyManager.dualGSMPhoneEnable())
s = SystemProperties.get("gsm.icc.sim.state");
else
s = SystemProperties.get("gsm.sim.state");
} else if (i == 11) {
if (HtcTelephonyManager.dualPhoneEnable()) {
if (HtcTelephonyManager.isDualGCPhone())
s = SystemProperties.get("gsm.icc.uim.state");
else
s = SystemProperties.get("gsm.icc.sim.state");
} else if (HtcTelephonyManager.dualGSMPhoneEnable())
s = SystemProperties.get("gsm.icc.sub.state");
else
s = SystemProperties.get("gsm.sim.state");
} else if (i == 1)
s = SystemProperties.get("gsm.icc.sim.state");
else if (i == 3)
s = SystemProperties.get("gsm.icc.sub.state");
else if (i == 2)
s = SystemProperties.get("gsm.icc.uim.state");
else
s = SystemProperties.get("gsm.sim.state");
if ("ABSENT".equals(s))
return HtcTelephonyManager.SIM_STATE_ABSENT;
if ("PIN_REQUIRED".equals(s))
return HtcTelephonyManager.SIM_STATE_PIN_REQUIRED;
if ("PUK_REQUIRED".equals(s))
return HtcTelephonyManager.SIM_STATE_PUK_REQUIRED;
if ("NETWORK_LOCKED".equals(s))
return HtcTelephonyManager.SIM_STATE_NETWORK_LOCKED;
return !"READY".equals(s) ? HtcTelephonyManager.SIM_STATE_UNKNOWN : HtcTelephonyManager.SIM_STATE_READY;
}
示例14: sendMessage
import android.os.SystemProperties; //导入方法依赖的package包/类
private void sendMessage(boolean bCheckEcmMode) {
if (bCheckEcmMode) {
// TODO: expose this in telephony layer for SDK build
String inEcm = SystemProperties
.get(TelephonyProperties.PROPERTY_INECM_MODE);
if (Boolean.parseBoolean(inEcm)) {
try {
startActivityForResult(
new Intent(
TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS,
null), REQUEST_CODE_ECM_EXIT_DIALOG);
return;
} catch (ActivityNotFoundException e) {
// continue to send message
Log.e(TAG, "Cannot find EmergencyCallbackModeExitDialog", e);
}
}
}
if (!mSendingMessage) {
if (LogTag.SEVERE_WARNING) {
String sendingRecipients = mConversation.getRecipients()
.serialize();
if (!sendingRecipients.equals(mDebugRecipients)) {
String workingRecipients = mWorkingMessage
.getWorkingRecipients();
if (!mDebugRecipients.equals(workingRecipients)) {
LogTag.warnPossibleRecipientMismatch(
"ComposeMessageActivity.sendMessage"
+ " recipients in window: \""
+ mDebugRecipients
+ "\" differ from recipients from conv: \""
+ sendingRecipients
+ "\" and working recipients: "
+ workingRecipients, this);
}
}
sanityCheckConversation();
}
// send can change the recipients. Make sure we remove the listeners
// first and then add
// them back once the recipient list has settled.
removeRecipientsListeners();
mWorkingMessage.send(mDebugRecipients);
mSentMessage = true;
mSendingMessage = true;
addRecipientsListeners();
mScrollOnSend = true; // in the next onQueryComplete, scroll the
// list to the end.
}
// But bail out if we are supposed to exit after the message is sent.
if (mExitOnSent) {
finish();
}
}
示例15: sendMessage
import android.os.SystemProperties; //导入方法依赖的package包/类
private void sendMessage(boolean bCheckEcmMode) {
if (bCheckEcmMode) {
// TODO: expose this in telephony layer for SDK build
String inEcm = SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE);
if (Boolean.parseBoolean(inEcm)) {
try {
startActivityForResult(
new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null),
REQUEST_CODE_ECM_EXIT_DIALOG);
return;
} catch (ActivityNotFoundException e) {
// continue to send message
Log.e(TAG, "Cannot find EmergencyCallbackModeExitDialog", e);
}
}
}
if (!mSendingMessage) {
if (LogTag.SEVERE_WARNING) {
String sendingRecipients = mConversation.getRecipients().serialize();
if (!sendingRecipients.equals(mDebugRecipients)) {
String workingRecipients = mWorkingMessage.getWorkingRecipients();
if (!mDebugRecipients.equals(workingRecipients)) {
LogTag.warnPossibleRecipientMismatch("ComposeMessageActivity.sendMessage" +
" recipients in window: \"" +
mDebugRecipients + "\" differ from recipients from conv: \"" +
sendingRecipients + "\" and working recipients: " +
workingRecipients, this);
}
}
sanityCheckConversation();
}
// send can change the recipients. Make sure we remove the listeners first and then add
// them back once the recipient list has settled.
removeRecipientsListeners();
mWorkingMessage.send(mDebugRecipients);
mSentMessage = true;
mSendingMessage = true;
addRecipientsListeners();
mScrollOnSend = true; // in the next onQueryComplete, scroll the list to the end.
}
// But bail out if we are supposed to exit after the message is sent.
if (mSendDiscreetMode) {
finish();
}
}