Example usage for android.os SystemProperties get

List of usage examples for android.os SystemProperties get

Introduction

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

Prototype

@NonNull
@SystemApi
public static String get(@NonNull String key) 

Source Link

Document

Get the String value for the given key .

Usage

From source file:org.wso2.emm.system.service.EMMSystemService.java

private void publishFirmwareBuildDate() {
    String buildDate;/*w  w  w . j a va  2s  .c o  m*/
    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));
    }
}

From source file:com.android.providers.contacts.ContactsSyncAdapter.java

/**
 * Make sure the contacts subscriptions we expect based on the current
 * accounts are present and that there aren't any extra subscriptions
 * that we don't expect./*from w  w  w.j ava  2 s  . c  om*/
 */
@Override
public void onAccountsChanged(String[] accountsArray) {
    if (!"yes".equals(SystemProperties.get("ro.config.sync"))) {
        return;
    }

    ContentResolver cr = getContext().getContentResolver();
    for (String account : accountsArray) {
        String value = Contacts.Settings.getSetting(cr, account, Contacts.Settings.SYNC_EVERYTHING);
        if (value == null) {
            Contacts.Settings.setSetting(cr, account, Contacts.Settings.SYNC_EVERYTHING, "1");
        }
        updateSubscribedFeeds(cr, account);
    }
}

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

/**
 * @return state of the volume at the specified mount point
 *///from   w  ww.  ja  v  a  2  s.co m
public String getVolumeState(String mountPoint) {
    synchronized (mVolumesLock) {
        String state = mVolumeStates.get(mountPoint);
        if (state == null) {
            Slog.w(TAG, "getVolumeState(" + mountPoint + "): Unknown volume");
            if (SystemProperties.get("vold.encrypt_progress").length() != 0) {
                state = Environment.MEDIA_REMOVED;
            } else {
                throw new IllegalArgumentException();
            }
        }

        return state;
    }
}

From source file:com.android.mms.ui.MessageUtils.java

/**
 * @return Whether use Sim Simulator Toll or not.
 *//*  w w  w . j  a v a 2s. c o  m*/
public static boolean isUseSubSimulator() {
    String enableNowSMS = SystemProperties.get("net.ENABLE_NOWSMS");
    String enableSimulator = SystemProperties.get("net.Enable_Simulator_Tool");
    if (enableNowSMS.equals("true") && enableSimulator.equals("true")) {
        return true;
    }
    return false;
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

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);
            }/*ww w . jav a2 s . c om*/
        }
    }

    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();

        // strip unicode chars before sending (if applicable)
        mWorkingMessage.setText(stripUnicodeIfRequested(mWorkingMessage.getText()));
        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();
    }
}