微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.os.SystemProperties的实例源码

项目:letv    文件ProductUtils.java   
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;
}
项目:Brevent    文件BreventApplication.java   
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);
        }
    }
}
项目:CameraDVR    文件SettingsDialog.java   
@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);
}
项目:CameraDVR    文件CameraActivity.java   
@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();
}
项目:CameraDVR    文件CameraActivity.java   
@Override
public void onResume() {
    super.onResume();

    updateButtonsstate();
    updateImpactLockView();

    if (mRecServ != null) {
        mRecServ.onResume();
    }

    showUIControls(true );
    showUIControls(false);

    SystemProperties.set("sys.dvr.run.state","3");
}
项目:iLocker    文件MiuiHelper.java   
/**
 * 打开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 {

   }
}
项目:product-emm    文件emmSystemService.java   
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.Code.FAILURE,Constants.Status.INTERNAL_ERROR,String.valueOf(DEFAULT_STATE_INFO_CODE));
    }
}
项目:product-emm    文件OTAServerManager.java   
/**
 * 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;
}
项目:droidel    文件ActivityThread.java   
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;
}
项目:androidProject    文件Launcher.java   
@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);
}
项目:letv    文件ProductUtils.java   
public static String getProductvariant() {
    String result = "";
    try {
        result = SystemProperties.get(PROPERTY_PRODUCT_VARIANT,null).toupperCase();
    } catch (Exception e) {
    } catch (Error e2) {
    }
    return result;
}
项目:letv    文件ProductUtils.java   
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");
}
项目:Brevent    文件AdbPortUtils.java   
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;
}
项目:PowerToggles    文件adbwirelessTracker.java   
@Override
public int getActualState(Context context) {
    try {
        return working ? STATE_INTERMEDIATE :
            ("5555".equals(SystemProperties.get("service.adb.tcp.port")) ? STATE_ENABLED : STATE_disABLED);
    } catch (Throwable e) {
        Debug.log(e);
        return STATE_disABLED;
    }
}
项目:CameraDVR    文件CameraActivity.java   
@Override
public void onPause() {
    super.onPause();
    if (mRecServ != null) {
        mRecServ.onPause();
    }

    SystemProperties.set("sys.dvr.run.state","2");
}
项目:android-framework-Tools-Utils    文件displayMetrics.java   
private static int getDeviceDensity() {
    // qemu.sf.lcd_density can be used to override ro.sf.lcd_density
    // when running in the emulator,allowing for dynamic configurations.
    // The reason for this is that ro.sf.lcd_density is write-once and is
    // set by the init process when it parses build.prop before anything else.
    return SystemProperties.getInt("qemu.sf.lcd_density",SystemProperties.getInt("ro.sf.lcd_density",DENSITY_DEFAULT));
}
项目:iLocker    文件MiuiHelper.java   
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;
}
项目:iLocker    文件MiuiHelper.java   
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);
  }
 }
}
项目:sms_DualCard    文件TransactionService.java   
private void removeNotification(int startId) {
    Log.d(TAG,"removeNotification,startId=" + startId);
    for (TxnRequest req : txnRequestsMap ) {
        if (req.serviceId == startId) {
            if (req.requestedSubId == -1) {
                Log.d(TAG,"Notification cleanup not required since subId is -1");
                return;
            }
            if (req.anyRequestFailed ==1) {
                // dont remove notification.
                Log.d(TAG,"Some transaction Failed for this sub,notification not cleared.");
            } else {
                // remove notification
                String ns = Context.NOTIFICATION_SERVICE;
                notificationmanager mnotificationmanager = (notificationmanager)
                        getApplicationContext().getSystemService(ns);
                mnotificationmanager.cancel(req.requestedSubId);

                boolean isSilent = true; //default,silent enabled.
                if ("prompt".equals(
                       SystemProperties.get(TelephonyProperties.PROPERTY_MMS_TRANSACTION))) {
                    isSilent = false;
                }

                if (isSilent) {
                    int nextSub = (req.requestedSubId ==1) ?0:1;
                    Log.d(TAG,"MMS silent transaction finished for sub="+nextSub);
                    Intent silentIntent = new Intent(getApplicationContext(),edu.bupt.mms.ui.SelectMmsSubscription.class);
                    silentIntent.putExtra(Mms.SUB_ID,nextSub);
                    silentIntent.putExtra("TRIGGER_SWITCH_ONLY",1);
                    getApplicationContext().startService(silentIntent);

                }
            }
        }
    }
}
项目:sms_DualCard    文件DownloadManager.java   
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);
}
项目:fruit.launcher    文件Launcher.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_HOME:
            if (mThumbnailWorkspace.isVisible()) {
                mThumbnailWorkspace.setmCurSelectedScreenIndex(mWorkspace.getDefaultScreen());
                closeThumbnailWorkspace(true);
                return true;
            }
            closeFolder();
            return true;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            if (SystemProperties.getInt("debug.launcher2.dumpstate",0) != 0) {
                dumpState();
                return true;
            }
            break;
        default:
            break;
        }
    } else if (event.getAction() == KeyEvent.ACTION_UP) {
        switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_HOME:
            return true;
        default:
            break;
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:android-aosp-mms    文件DownloadManager.java   
static boolean isRoaming() {
    // Todo: fix and put in Telephony layer
    String roaming = SystemProperties.get(
            TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,"roaming ------> " + roaming);
    }
    return "true".equals(roaming);
}
项目:ProgressManager    文件a.java   
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);
}
项目:letv    文件DeviceUtils.java   
public static String getLetvRomVersion() {
    return SystemProperties.get(PROPERTY_RELEASE_VERSION,"");
}
项目:Brevent    文件AppsdisabledFragment.java   
static boolean isEmulator() {
    return "1".equals(SystemProperties.get("ro.kernel.qemu",Build.UNKNowN));
}
项目:Brevent    文件AppsdisabledFragment.java   
static boolean isAdbRunning() {
    return "running".equals(SystemProperties.get("init.svc.adbd",Build.UNKNowN));
}
项目:AdBlocker_Reborn    文件PreferencesHelper.java   
public static boolean isMiui() {
    return !SystemProperties.get("ro.miui.ui.version.name","").equals("");
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。