Example usage for android.util Log wtf

List of usage examples for android.util Log wtf

Introduction

In this page you can find the example usage for android.util Log wtf.

Prototype

public static int wtf(String tag, Throwable tr) 

Source Link

Document

What a Terrible Failure: Report an exception that should never happen.

Usage

From source file:edu.umich.flowfence.service.Sandbox.java

private void handleConnected(IBinder service) {
    synchronized (mSync) {
        if (isConnectedLocked()) {
            Log.w(TAG, "Connected while already connected");
        }/*from w w  w  . ja v a  2 s  .  c  om*/

        if (localLOGD) {
            Log.d(TAG, String.format("Service connected for sandbox %d", mID));
        }
        mSandboxService = ISandboxService.Stub.asInterface(service);
        mTaintSet = TaintSet.EMPTY;
        mAssignedPackage = null;
        mCurrentlyRunning = null;
        mKnownPackages.addAll(s_mKnownPackages);
        try {
            mPid = mSandboxService.getPid();
        } catch (RemoteException e) {
            Log.wtf(TAG, e);
            throw new RuntimeException(e);
        } finally {
            mSync.open();
        }
    }
    onConnected.fire(this, null);
}

From source file:conexionSiabra.Oauth.java

private void setAccessTokens(String result) {
    Log.wtf("RESULT", result);
    ACCESS_TOKEN = result.substring(12, result.indexOf("&oauth_token_secret="));// 12
    ACCESS_TOKEN_SECRET = result.substring(result.indexOf("&oauth_token_secret=") + 20); // IT INCLUDES A SPACE
    // AT THE END !!! (1
    // hour to discover it!
    // I love this game! )
    ACCESS_TOKEN_SECRET = ACCESS_TOKEN_SECRET.substring(0, ACCESS_TOKEN_SECRET.length() - 1); // IT ERASE THE SPACE !!
    // I feel that compiler does not consider my comments :(
}

From source file:com.digi.android.wva.fragments.EndpointOptionsDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (mConfig == null && savedInstanceState == null) {
        Log.e(TAG, "mConfig is null, not showing dialog!");
        return null;
    }//from   www.j ava2  s. c  om

    LayoutInflater inf = getActivity().getLayoutInflater();
    View v = inf.inflate(R.layout.dialog_endpoint_options, null);

    // Suppresses warnings, and ensures the layout exists.
    assert v != null;
    final TextView subIntervalTV = (TextView) v.findViewById(R.id.textView_interval);
    final TextView alarmInfoTV = (TextView) v.findViewById(R.id.alarm_info);
    final CheckBox subscribedCB = (CheckBox) v.findViewById(R.id.subscribedCheckbox);
    final CheckBox alarmCB = (CheckBox) v.findViewById(R.id.alarmCheckbox);
    final EditText subInterval = (EditText) v.findViewById(R.id.subscriptionInterval);
    final EditText alarmThreshold = (EditText) v.findViewById(R.id.alarmThreshold);
    final Spinner typeSpinner = (Spinner) v.findViewById(R.id.alarmTypeSpinner);
    final LinearLayout makeAlarmSection = (LinearLayout) v.findViewById(R.id.section_make_alarm);
    final LinearLayout showAlarmSection = (LinearLayout) v.findViewById(R.id.section_show_alarm);
    final CheckBox dcSendCB = (CheckBox) v.findViewById(R.id.dcPushCheckbox);

    String alarmInfo = "No alarm yet";
    boolean isSubscribed = false;
    String endpointName = "UNKNOWN";
    int sinterval = 10;
    boolean alarmCreated = false;
    double threshold = 0;
    int alarmtypeidx = 0;

    boolean isSendingToDC = false;

    if (savedInstanceState != null && savedInstanceState.containsKey("config")) {
        mConfig = savedInstanceState.getParcelable("config");
    }

    if (mConfig != null) {
        endpointName = mConfig.getEndpoint();
        alarmInfo = mConfig.getAlarmSummary();

        if (mConfig.getSubscriptionConfig() != null) {
            isSubscribed = mConfig.getSubscriptionConfig().isSubscribed();
            sinterval = mConfig.getSubscriptionConfig().getInterval();
            isSendingToDC = mConfig.shouldBePushedToDeviceCloud();
        } else {
            // Not subscribed; default interval value from preferences.
            String i = PreferenceManager.getDefaultSharedPreferences(getActivity())
                    .getString("pref_default_interval", "0");
            try {
                sinterval = Integer.parseInt(i);
            } catch (NumberFormatException e) {
                Log.d(TAG, "Failed to parse default interval from preferences: " + i);
                sinterval = 0;
            }
        }

        if (mConfig.getAlarmConfig() != null) {
            alarmCreated = mConfig.getAlarmConfig().isCreated();
            threshold = mConfig.getAlarmConfig().getThreshold();
            String typestr = AlarmType.makeString(mConfig.getAlarmConfig().getType());
            for (int i = 0; i < alarmTypes.length; i++) {
                if (alarmTypes[i].toLowerCase(Locale.US).equals(typestr))
                    alarmtypeidx = i;
            }
        }
    }

    // Set up event listeners on EditText and CheckBox items

    subscribedCB.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            subInterval.setEnabled(isChecked);
            subIntervalTV.setEnabled(isChecked);
        }
    });

    alarmCB.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            typeSpinner.setEnabled(isChecked);
            alarmThreshold.setEnabled(false);
            // If type spinner is set to Change, we want threshold disabled again
            if (isChecked) {
                alarmThreshold.setEnabled(!shouldDisableAlarmThreshold(typeSpinner.getSelectedItemPosition()));
            }
        }
    });

    typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {
            if (alarmCB.isChecked() && shouldDisableAlarmThreshold(position))
                alarmThreshold.setEnabled(false);
            else if (!alarmCB.isChecked())
                alarmThreshold.setEnabled(false);
            else
                alarmThreshold.setEnabled(true);
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    subIntervalTV.setEnabled(false);
    subInterval.setEnabled(false);
    alarmThreshold.setEnabled(false);
    typeSpinner.setEnabled(false);
    alarmInfoTV.setText(alarmInfo);

    // Click checkboxes, show data depending on if subscription or alarm
    // has been added already
    if (isSubscribed)
        subscribedCB.performClick();
    if (alarmCreated) {
        showAlarmSection.setVisibility(View.VISIBLE);
        makeAlarmSection.setVisibility(View.GONE);
        alarmCB.setText("Remove alarm");
    } else {
        makeAlarmSection.setVisibility(View.VISIBLE);
        showAlarmSection.setVisibility(View.GONE);
        alarmCB.setText("Create alarm");
    }

    dcSendCB.setChecked(isSendingToDC);

    subInterval.setText(Integer.toString(sinterval));

    alarmThreshold.setText(Double.toString(threshold));

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.alarm_types,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    typeSpinner.setAdapter(adapter);
    typeSpinner.setSelection(alarmtypeidx);

    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int i) {
            // Fetch the EndpointsAdapter's configuration for this endpoint.
            // (We might have gotten mConfig from the saved instance bundle)
            EndpointConfiguration cfg = EndpointsAdapter.getInstance()
                    .findEndpointConfiguration(mConfig.getEndpoint());

            // Set whether this endpoint's data should be pushed to Device Cloud
            if (cfg != null) {
                cfg.setPushToDeviceCloud(dcSendCB.isChecked());
            }

            // Handle (un)subscribing

            if (isUnsubscribing(subscribedCB.isChecked())) {
                unsubscribe(mConfig.getEndpoint());
            } else if (subscribedCB.isChecked()) {
                if (handleMakingSubscription(subInterval)) {
                    // Subscription was successful... most likely.
                    Log.d(TAG, "Probably subscribed to endpoint.");
                } else {
                    // Invalid interval.
                    Toast.makeText(getActivity(),
                            getString(R.string.configure_endpoints_toast_invalid_sub_interval),
                            Toast.LENGTH_SHORT).show();
                }
            }

            // Handle adding/removing alarm as necessary

            if (isRemovingAlarm(alarmCB.isChecked())) {
                removeAlarm(mConfig.getEndpoint(), mConfig.getAlarmConfig().getType());
            } else if (alarmCB.isChecked()) {
                Editable thresholdText = alarmThreshold.getText();
                String thresholdString;
                if (thresholdText == null)
                    thresholdString = "";
                else
                    thresholdString = thresholdText.toString();

                double threshold;
                try {
                    threshold = Double.parseDouble(thresholdString);
                } catch (NumberFormatException e) {
                    Toast.makeText(getActivity(), getString(R.string.configure_endpoints_invalid_threshold),
                            Toast.LENGTH_SHORT).show();
                    return;
                }

                int alarmidx = typeSpinner.getSelectedItemPosition();
                if (alarmidx == -1) {
                    // But... how?
                    Log.wtf(TAG, "alarm type index -1 ?");
                    return;
                }
                String type = alarmTypes[alarmidx];
                AlarmType atype = AlarmType.fromString(type);

                createAlarm(mConfig.getEndpoint(), atype, threshold);
            }

            dialog.dismiss();
        }
    };

    return new AlertDialog.Builder(getActivity()).setView(v).setTitle("Endpoint: " + endpointName)
            .setPositiveButton("Save", clickListener)
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // Cancel means just dismiss the dialog.
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.CloudRecognition.CloudReco.java

public void startFinderIfStopped() {

    if (!mFinderStarted) {
        Log.wtf("Se", "ha perdido el objeto");//COMIENZA EL ESCANER CUANDO NO SE PIERDE EL OBJETO ESCANEADO
        loadingDialogHandler.sendEmptyMessage(HIDE_EVERYTHING);//
        mFinderStarted = true;/* w w  w. j av a2  s  . c  om*/

        // Get the image tracker:
        TrackerManager trackerManager = TrackerManager.getInstance();
        ImageTracker imageTracker = (ImageTracker) trackerManager.getTracker(ImageTracker.getClassType());

        // Initialize target finder:
        TargetFinder targetFinder = imageTracker.getTargetFinder();

        targetFinder.clearTrackables();
        targetFinder.startRecognition();
    }
}

From source file:de.jadehs.jadehsnavigator.fragment.VorlesungsplanFragment.java

public void setCurrentWeekNumber() {
    //this.weekOfYear = new SimpleDateFormat("w").format(new java.util.Date()).toString();
    this.weekOfYear = "" + calendarHelper.getWeekNumber();
    Log.wtf("weekOfYear", this.weekOfYear);
}

From source file:de.jadehs.jadehsnavigator.fragment.VorlesungsplanFragment.java

public void setCurrentWeekNumber(int which) {
    //this.weekOfYear = new SimpleDateFormat("w").format(new java.util.Date()).toString();
    this.weekOfYear = "" + which;
    Log.wtf("weekOfYear", this.weekOfYear);
}

From source file:com.achep.acdisplay.ui.components.MediaWidget.java

@Override
public void onClick(@NonNull View v) {
    int action;/*w  w w  .j  av a 2 s. c  om*/
    if (v == mButtonPrevious) {
        action = MediaController2.ACTION_SKIP_TO_PREVIOUS;
    } else if (v == mButtonPlayPause) {
        action = MediaController2.ACTION_PLAY_PAUSE;
    } else if (v == mButtonNext) {
        action = MediaController2.ACTION_SKIP_TO_NEXT;
    } else {
        Log.wtf(TAG, "Received click event from an unknown view.");
        return;
    }

    mMediaController.sendMediaAction(action);
    mCallback.requestTimeoutRestart(this);
}

From source file:uk.co.spookypeanut.wake_me_at.WakeMeAtService.java

@Override
public void onProviderDisabled(String provider) {
    String lp = this.getResources().getStringArray(R.array.locProvAndroid)[mProvider];
    if (provider != lp) {
        Log.wtf(LOG_NAME,
                "Current provider (" + lp + ") doesn't match the listener provider (" + provider + ")");

    }//from   www  . ja va  2 s  .c o m
    String message = String.format(getString(R.string.providerDisabledMessage),
            this.getResources().getStringArray(R.array.locProvHuman)[mProvider]);
    Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
}

From source file:de.spiritcroc.ownlog.ui.fragment.ImportLogFragment.java

private ImportInfo[] createInitialImportInfos(SQLiteDatabase localDb) {
    mLocalAvailableTags = LoadTagItemsTask.loadAvailableTags(localDb, null);
    ImportInfo[] result = new ImportInfo[mLogItems.length];
    for (int index = 0; index < result.length; index++) {
        String selection = DbContract.Log._ID + " = " + mLogItems[index].id;
        ArrayList<LogItem> localLogItem = LoadLogItemsTask.loadLogItems(localDb, selection,
                LoadLogItemsTask.getFullProjection(), null, true, true);
        if (localLogItem.isEmpty()) {
            result[index] = new ImportInfo(ImportItemInfo.ChangeStatus.NEW);
        } else {// w ww  .jav a2  s .co  m
            if (localLogItem.size() != 1) {
                Log.wtf(TAG, "Multiple log entries with id " + mLogItems[index].id);
            }
            LogItem localItem = localLogItem.get(0);
            LogItem importItem = mLogItems[index];
            if (localItem.differs(importItem)) {
                if (localItem.newerThan(importItem)) {
                    result[index] = new ImportInfo(ImportItemInfo.ChangeStatus.DEPRECATED);
                } else if (importItem.newerThan(localItem)) {
                    result[index] = new ImportInfo(ImportItemInfo.ChangeStatus.UPDATED);
                } else {
                    result[index] = new ImportInfo(ImportItemInfo.ChangeStatus.CHANGED);
                }
            } else {
                result[index] = new ImportInfo(ImportItemInfo.ChangeStatus.SAME);
            }

            // Check tag changes
            result[index].tagChangeStatus = Util.getListDiffChangeStatus(localItem.tags, importItem.tags);

            // Check attachment changes
            ArrayList<LogItem.Attachment> localAttachments = LoadLogItemAttachmentsTask.loadAttachments(localDb,
                    LoadLogItemAttachmentsTask.getSelectionFromLogIds(mLogItems[index].id),
                    LoadLogItemAttachmentsTask.getFullProjection(), null);
            result[index].attachmentChangeStatus = Util.getListDiffChangeStatus(localAttachments,
                    mImportAttachments[index]);
        }
    }
    return result;
}

From source file:com.achep.acdisplay.ui.components.MediaWidget.java

@Override
public boolean onLongClick(@NonNull View v) {
    if (v == mButtonPlayPause) {
        mMediaController.sendMediaAction(MediaController2.ACTION_STOP);
    } else {/*from  ww  w  .  j  a  v  a2s. c  o m*/
        Log.wtf(TAG, "Received long-click event from an unknown view.");
        return false;
    }

    mCallback.requestTimeoutRestart(this);
    return true;
}