Example usage for android.os SystemProperties set

List of usage examples for android.os SystemProperties set

Introduction

In this page you can find the example usage for android.os SystemProperties set.

Prototype

@UnsupportedAppUsage
public static void set(@NonNull String key, @Nullable String val) 

Source Link

Document

Set the value for the given key to val .

Usage

From source file:me.piebridge.prevent.framework.SystemReceiver.java

private void reboot() {
    SystemProperties.set("sys.powerctl", "reboot");
}

From source file:me.piebridge.prevent.framework.SystemReceiver.java

private void softReboot() {
    SystemProperties.set("ctl.restart", "surfaceflinger");
    SystemProperties.set("ctl.restart", "zygote");
}

From source file:com.compal.wifitest.WifiTestCase.java

public void test_4th_d_WepConnection() throws InterruptedException {
    if (WepBeTest) {
        testCaseId = getTestCaseId(tWep, dWep, sId);
        if (mWifiManager != null) {
            currentAPType = dWep;//from  w ww . ja v a  2 s. co  m
            mLog = "WepConnection";
            Log.i(tag, "test_4th_d_WepConnection start");
            if (checkWifiOnOffState(test_WifiOff)) {
                enableWifi(true);
            }
            loadedWepAPSsid = getTestCaseId(tWep, dWep, sRemark1);
            loadedWepAPKey = getTestCaseId(tWep, dWep, sRemark2);
            WepAPSsid = convertToQuotedString(loadedWepAPSsid);
            WepAPKey = convertToQuotedString(loadedWepAPKey);
            if (testAP(dWep)) {
                checkHttpClientTest(dWep);
            } else {
                //output fail result
                mLog = "supplicant state not complete or connecion timeout or can't get ip";
                outputResult(false, tWep, dWep, testCaseId);
            }
            Log.i(tag, "test_4th_d_WepConnection end");
        } else {
            outputResult(false, tWep, dWep, testCaseId);
        }
    }
    SystemProperties.set("persist.sys.test", "WifiTestIsdone");
    enableWifi(false); //turn off wifi in the end
}

From source file:com.compal.telephonytest.TelephonyTest.java

public void test_6th_ReadPhoneBook() {
    String sName = "name";
    String sNumber = "number";
    String sEmails = "emails";
    String s_id = "_id";
    if (TelephonyBeTest) {
        Log.i(tag, "test_6th_ReadPhoneBook start");
        testCaseId = getTestCaseId(tTelephonyBasicFunc, dSimRead, sId);
        mLog = "Read PhoneBook";
        if (!isIccCardNull) {
            Uri simUri = Uri.parse("content://icc/adn");
            Cursor cursorSim = context.getContentResolver().query(simUri, null, null, null, null);
            Log.i(tag, "getColumnIndex(sName):" + Integer.toString(cursorSim.getColumnIndex(sName)));
            Log.i(tag, "getColumnIndex(sNumber):" + Integer.toString(cursorSim.getColumnIndex(sNumber)));
            Log.i(tag, "sim row count:" + Integer.toString(cursorSim.getCount()));
            String[] simColNm = cursorSim.getColumnNames();
            for (int i = 0; i < simColNm.length; i++)
                Log.i(tag, "simColNm:" + simColNm[i]);

            if (simColNm.length >= 0 && simColNm[0].equals(sName) && simColNm[1].equals(sNumber)
                    && simColNm[2].equals(sEmails) && simColNm[3].equals(s_id)) {
                Log.i(tag, "test_6th_ReadPhoneBook() true");
                outputResult(true, tTelephonyBasicFunc, dSimRead, testCaseId);
            } else {
                Log.i(tag, "test_6th_ReadPhoneBook() false");
                mLog = "simColNm.length < 0 || read column name error";
                outputResult(false, tTelephonyBasicFunc, dSimRead, testCaseId);
            }//from w w w  .  ja v a 2 s.c om
        } else {
            Log.i(tag, "test_6th_ReadPhoneBook() isIccCardNull");
            mLog = "isIccCardNull";
            outputResult(false, tTelephonyBasicFunc, dSimRead, testCaseId);
        }
    }

    SystemProperties.set("persist.sys.test", "TelephonyTestIsdone");
    enableDataEnabled(false); //turn off 3g in the end
}

From source file:com.android.server.MountService.java

private void copyLocaleFromMountService() {
    String systemLocale;//  w w  w  .jav a  2  s  . co  m
    try {
        systemLocale = getField(StorageManager.SYSTEM_LOCALE_KEY);
    } catch (RemoteException e) {
        return;
    }
    if (TextUtils.isEmpty(systemLocale)) {
        return;
    }

    Slog.d(TAG, "Got locale " + systemLocale + " from mount service");
    Locale locale = Locale.forLanguageTag(systemLocale);
    Configuration config = new Configuration();
    config.setLocale(locale);
    try {
        ActivityManagerNative.getDefault().updateConfiguration(config);
    } catch (RemoteException e) {
        Slog.e(TAG, "Error setting system locale from mount service", e);
    }

    // Temporary workaround for http://b/17945169.
    Slog.d(TAG, "Setting system properties to " + systemLocale + " from mount service");
    SystemProperties.set("persist.sys.language", locale.getLanguage());
    SystemProperties.set("persist.sys.country", locale.getCountry());
}