本文整理汇总了Java中android.os.SystemProperties类的典型用法代码示例。如果您正苦于以下问题:Java SystemProperties类的具体用法?Java SystemProperties怎么用?Java SystemProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SystemProperties类属于android.os包,在下文中一共展示了SystemProperties类的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: stopAdbIfNeededSync
import android.os.SystemProperties; //导入依赖的package包/类
private void stopAdbIfNeededSync() {
if ("1".equals(SystemProperties.get("service.adb.brevent.close", ""))) {
boolean connected = checkPort();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
SimpleSu.su("pbd=`pidof brevent_daemon`; " +
"pbs=`pidof brevent_server`; " +
"pin=`pidof installd`; " +
"echo $pbd > /acct/uid_0/pid_$pin/tasks; " +
"echo $pbd > /acct/uid_0/pid_$pin/cgroup.procs; " +
"echo $pbs > /acct/uid_0/pid_$pin/tasks; " +
"echo $pbs > /acct/uid_0/pid_$pin/cgroup.procs");
}
String command = needStop ? "setprop ctl.stop adbd" : "setprop ctl.restart adbd";
SimpleSu.su("setprop service.adb.tcp.port -1; " +
"setprop service.adb.brevent.close 0; " + command);
BreventIntentService.sleep(1);
if (connected && !checkPort()) {
setRootAdb(false);
}
}
}
示例4: onClick
import android.os.SystemProperties; //导入依赖的package包/类
@Override
public void onClick(View v) {
boolean isChecked = !v.isSelected();
switch (v.getId()) {
case R.id.poweron_recording_switch:
SystemProperties.set(Settings.KEY_POWERON_RECORD, isChecked ? "1" : "0");
break;
case R.id.watermark_switch:
mRecServ.setWatermarkEnable(isChecked);
Settings.set(Settings.KEY_WATERMARK_ENABLE, isChecked ? 1 : 0);
break;
case R.id.flip_switcher:
break;
}
v.setSelected(isChecked);
}
示例5: onDestroy
import android.os.SystemProperties; //导入依赖的package包/类
@Override
public void onDestroy() {
Log.d(TAG, "onDestroy");
// unbind record service
unbindService(mRecServiceConn);
// stop record service
Intent i = new Intent(CameraActivity.this, RecordService.class);
stopService(i);
// remove all messages
mHandler.removeMessages(0);
SystemProperties.set("sys.dvr.run.state", "0");
super.onDestroy();
}
示例6: onResume
import android.os.SystemProperties; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
updateButtonsState();
updateImpactLockView();
if (mRecServ != null) {
mRecServ.onResume();
}
showUIControls(true );
showUIControls(false);
SystemProperties.set("sys.dvr.run.state", "3");
}
示例7: 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));
}
}
示例8: compareLocalVersionToServer
import android.os.SystemProperties; //导入依赖的package包/类
/**
* Compares device firmware version with the latest upgrade file from the server.
*
* @return - Returns true if the firmware needs to be upgraded.
*/
public boolean compareLocalVersionToServer(BuildPropParser parser) {
if (parser == null) {
Log.d(TAG, "compareLocalVersion Without fetch remote prop list.");
return false;
}
Long buildTime = Long.parseLong(SystemProperties.get(BUILD_DATE_UTC_PROPERTY));
String buildTimeUTC = parser.getProp(BUILD_DATE_UTC_PROPERTY);
Long remoteBuildUTC;
if ((buildTimeUTC != null) && (!(buildTimeUTC.equals("null")))) {
remoteBuildUTC = Long.parseLong(buildTimeUTC);
} else {
remoteBuildUTC = Long.MIN_VALUE;
Log.e(TAG, "UTC date not found in config file, config may be corrupted or missing");
}
Log.d(TAG, "Local Version:" + Build.VERSION.INCREMENTAL + " Server Version:" + parser.getNumRelease());
boolean upgrade = remoteBuildUTC > buildTime;
Log.d(TAG, "Remote build time : " + remoteBuildUTC + " Local build time : " + buildTime);
return upgrade;
}
示例9: 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;
}
示例10: dispatchKeyEvent
import android.os.SystemProperties; //导入依赖的package包/类
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HOME:
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (SystemProperties.getInt("debug.launcher2.dumpstate", 0) != 0) {
dumpState();
return true;
}
break;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
示例11: performStart
import android.os.SystemProperties; //导入依赖的package包/类
final void performStart() {
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
mFragments.noteStateNotSaved();
mCalled = false;
mFragments.execPendingActions();
mInstrumentation.callActivityOnStart(this);
if (!mCalled) {
throw new SuperNotCalledException(
"Activity " + mComponent.toShortString() +
" did not call through to super.onStart()");
}
mFragments.dispatchStart();
mFragments.reportLoaderStart();
// This property is set for all builds except final release
boolean isDlwarningEnabled = SystemProperties.getInt("ro.bionic.ld.warning", 0) == 1;
boolean isAppDebuggable =
(mApplication.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
if (isAppDebuggable || isDlwarningEnabled) {
String dlwarning = getDlWarning();
if (dlwarning != null) {
String appName = getApplicationInfo().loadLabel(getPackageManager())
.toString();
String warning = "Detected problems with app native libraries\n" +
"(please consult log for detail):\n" + dlwarning;
if (isAppDebuggable) {
new AlertDialog.Builder(this).
setTitle(appName).
setMessage(warning).
setPositiveButton(android.R.string.ok, null).
setCancelable(false).
show();
} else {
Toast.makeText(this, appName + "\n" + warning, Toast.LENGTH_LONG).show();
}
}
}
mActivityTransitionState.enterReady(this);
}
示例12: getProductVariant
import android.os.SystemProperties; //导入依赖的package包/类
public static String getProductVariant() {
String result = "";
try {
result = SystemProperties.get(PROPERTY_PRODUCT_VARIANT, null).toUpperCase();
} catch (Exception e) {
} catch (Error e2) {
}
return result;
}
示例13: isYunOS
import android.os.SystemProperties; //导入依赖的package包/类
public static boolean isYunOS() {
String hw = "";
try {
hw = SystemProperties.get("ro.yunos.hardware", null).toLowerCase();
} catch (Exception e) {
} catch (Error e2) {
}
return !TextUtils.isEmpty(hw) && hw.equals("yunos");
}
示例14: getLetvRomVersion
import android.os.SystemProperties; //导入依赖的package包/类
public static String getLetvRomVersion() {
return SystemProperties.get(PROPERTY_RELEASE_VERSION, "");
}
示例15: 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;
}