Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

In this page you can find the example usage for android.os RemoteException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

final private void unbindScheduler() {
    mGlblParms.util.addDebugMsg(1, "I", "unbindScheduler entered");
    if (mSvcClientCallback != null) {
        try {//from ww w  .java  2 s . co  m
            if (mSvcServer != null)
                mSvcServer.removeCallBack(mSvcClientCallback);
            mSvcClientCallback = null;
        } catch (RemoteException e) {
            e.printStackTrace();
            mGlblParms.util.addLogMsg("E", "removeListener error :" + e.toString());
        }
    }
    unbindService(mSvcConnScheduler);
}

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

final private void setCallbackListener() {
    mGlblParms.util.addDebugMsg(1, "I", "setCallbackListener entered");
    mSvcClientCallback = new ISchedulerCallback.Stub() {
        final public void notifyToClient(String resp_time, final String resp, final String grp,
                final String task, final String action, String dialog_id, final int atc, final int resp_cd,
                final String msg) throws RemoteException {
            if (mEnvParms.settingDebugLevel >= 2)
                mGlblParms.util.addDebugMsg(2, "I", "Notify received ", "Resp=", resp, ", Task=", task,
                        ", action=", action, ", " + "dialog_id=", dialog_id);
            handler.post(new Runnable() {
                @Override//from   w w w .  j  av a2  s  .  c  o m
                public void run() {
                    refreshActiveTaskStatus(atc);
                }
            });
        }
    };
    try {
        mSvcServer.setCallBack(mSvcClientCallback);
    } catch (RemoteException e) {
        e.printStackTrace();
        mGlblParms.util.addLogMsg("E", "setCallbackListener error :" + e.toString());
    }
}

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

public static int getCellularState(int selectedSubId, Context context) {
    MmsLog.d(TAG, "getCellularState() subid: " + selectedSubId);
    ITelephonyEx telephonyEx = ITelephonyEx.Stub
            .asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE_EX));
    Bundle bundle = null;// ww  w  .  j  a v  a 2  s  . com
    try {
        bundle = telephonyEx.getServiceState(selectedSubId);
    } catch (RemoteException e) {
        e.printStackTrace();
        return ServiceState.STATE_OUT_OF_SERVICE;
    }
    if (bundle != null) {
        return ServiceState.newFromBundle(bundle).getState();
    } else {
        return ServiceState.STATE_OUT_OF_SERVICE;
    }
}

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

final private void cancelSpecificTask(boolean dlg_req, final AdapterProfileList tpfa, final String grp,
        final String tn) {
    if (dlg_req) {
        NotifyEvent ntfy = new NotifyEvent(this);
        ntfy.setListener(new NotifyEventListener() {
            @Override/*from w  w  w  .  j a v  a 2s .  c  om*/
            final public void positiveResponse(Context c, Object[] o) {
                try {
                    mSvcServer.aidlCancelSpecificTask(grp, tn);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }

            @Override
            final public void negativeResponse(Context c, Object[] o) {
            }
        });
        mGlblParms.commonDlg.showCommonDialog(true, "W", getString(R.string.msgs_main_cancel_confirm_title),
                getString(R.string.msgs_main_cancel_confirm_msg) + "\n" + tn, ntfy);

    } else {
        try {
            mSvcServer.aidlCancelSpecificTask(grp, tn);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

final private void cancelAllActiveTask(final AdapterProfileList tpfa) {
    String tl = "";
    for (int i = 0; i < tpfa.getDataListCount(); i++) {
        ProfileListItem tpli = tpfa.getDataListItem(i);
        if (tpli.isTaskActive()) {
            tl = tl + "\n" + tpli.getProfileGroup() + ", " + tpli.getProfileName();
        }// www .  j  a  va 2 s  .c  o m
    }
    NotifyEvent ntfy = new NotifyEvent(this);
    ntfy.setListener(new NotifyEventListener() {
        @Override
        final public void positiveResponse(Context c, Object[] o) {
            try {
                mSvcServer.aidlCancelAllActiveTask();
            } catch (RemoteException e) {
                e.printStackTrace();
            }

            //            for (int i=0;i<tpfa.getDataListCount();i++) {
            //               ProfileListItem tpli=tpfa.getDataListItem(i);
            //               if (tpli.isTaskActive()) {
            //                  try {
            //                     svcServer.aidlCancelSpecificTask(
            //                           tpli.getProfileGroup(),tpli.getProfileName());
            //                  } catch (RemoteException e) {
            //                     e.printStackTrace();
            //                  }
            //               }
            //            }
        }

        @Override
        final public void negativeResponse(Context c, Object[] o) {
        }
    });
    mGlblParms.commonDlg.showCommonDialog(true, "W", getString(R.string.msgs_main_cancel_confirm_title),
            getString(R.string.msgs_main_cancel_confirm_msg) + tl, ntfy);

}

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

@Override
final public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_top_show_history:
        showHistory();//from w  ww . j a va  2 s .  c o  m
        return true;
    //         case R.id.menu_top_export_profile:
    //            profMaint.exportProfileDlg(profileAdapter, mGlblParms.profileListView);
    //            return true;         
    //         case R.id.menu_top_import_profile:
    //            importProfile(profileAdapter, mGlblParms.profileListView);
    //            return true;         
    case R.id.menu_top_settings:
        invokeSettingsActivity();
        return true;
    case R.id.menu_top_browse_logfile:
        invokeLogFileBrowser();
        return true;
    case R.id.menu_top_toggle_scheduler:
        mEnvParms.setSettingEnableScheduler(mContext, !mEnvParms.settingEnableScheduler);
        try {
            mSvcServer.aidlCancelAllActiveTask();
            mSvcServer.aidlResetScheduler();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        refreshOptionMenu();
        setSchedulerStatus();
        return true;
    //         case R.id.menu_top_quick_task:
    //              NotifyEvent ntfy=setQuickTaskListener();
    //              QuickTaskMaintenance quickTask=new QuickTaskMaintenance(context,util, commonDlg, 
    //                     profMaint, profileAdapter, ntfy);
    //              quickTask.initializeQuickTaskView();
    //            return true;         
    case R.id.menu_top_about:
        aboutTaskAutomation();
        return true;
    //         case R.id.menu_top_send_logfile:
    //            sendTaskAutomationLogFile();
    //            return true;         
    case R.id.menu_top_uninstall:
        uninstallApplication();
        return true;
    //         case R.id.menu_top_quit:
    //            finish();
    //            return true;         
    }
    return false;
}

From source file:net.sourceforge.servestream.activity.MediaPlayerActivity.java

private void initPager() {
    if (mService == null) {
        return;/*from   w  w w.j  a  v a 2s. c om*/
    }

    int count = 0;

    try {
        count = mService.getQueue().length + 2;
    } catch (RemoteException e) {
        finish();
    }

    mAdapter = new GridPagerAdapter(getSupportFragmentManager(), count);
    mPager.setAdapter(mAdapter);
    mPager.setOnPageChangeListener(new OnPageChangeListener() {

        boolean mFromUser = false;

        @Override
        public void onPageScrollStateChanged(int state) {
            if (state == ViewPager.SCROLL_STATE_DRAGGING) {
                mFromUser = true;
            } else if (state == ViewPager.SCROLL_STATE_IDLE) {
                mFromUser = false;
            }
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int position) {
            try {
                if (mFromUser) {
                    position--;

                    if (position == -1) {
                        position = mService.getQueue().length - 1;
                    } else if (position == mService.getQueue().length) {
                        position = 0;
                    }

                    mService.setQueuePosition(position);
                    mFromUser = false;
                }
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    });

    setPager();
}

From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java

final private void applySettingParms() {
    try {//w  w  w . j  a va2 s. c  o m
        boolean restart_scheduler = false;
        if (getPrefsMgr().getBoolean(getString(R.string.settings_main_restart_scheduler), false)) {
            getPrefsMgr().edit().putBoolean(getString(R.string.settings_main_restart_scheduler), false)
                    .commit();
            restart_scheduler = true;
        }
        boolean pms = mEnvParms.settingEnableScheduler;
        boolean p_admin = mEnvParms.settingDeviceAdmin;
        int p_tpc = mEnvParms.settingTaskExecThreadPoolCount;
        String p_intvl = mEnvParms.settingSleepOption;
        boolean p_light_sensor_thread = mEnvParms.settingLightSensorUseThread;

        mEnvParms.loadSettingParms(mContext);
        if (mEnvParms.settingLogMsgDir.equals("")) {
            mEnvParms.settingLogMsgDir = Environment.getExternalStorageDirectory().toString() + "/"
                    + APPLICATION_TAG + "/";
            getPrefsMgr().edit()
                    .putString(mContext.getString(R.string.settings_main_log_dir), mEnvParms.settingLogMsgDir)
                    .commit();
        } else {
            if (!mEnvParms.settingLogMsgDir.endsWith("/")) {
                mEnvParms.settingLogMsgDir += "/";
                getPrefsMgr().edit().putString(mContext.getString(R.string.settings_main_log_dir),
                        mEnvParms.settingLogMsgDir).commit();
            }
        }

        int n_tpc = mEnvParms.settingTaskExecThreadPoolCount;

        String n_intvl = mEnvParms.settingSleepOption;

        if (mEnvParms.settingDebugLevel == 0)
            DEBUG_ENABLE = false;
        else
            DEBUG_ENABLE = true;

        if (isBooleanDifferent(p_admin, mEnvParms.settingDeviceAdmin))
            switchDeviceAdminStatus(mEnvParms.settingDeviceAdmin);

        mGlblParms.util.addDebugMsg(1, "I", "initSettingParms ");
        mGlblParms.util.addDebugMsg(1, "I", "  localRootDir=" + mEnvParms.localRootDir);
        mGlblParms.util.addDebugMsg(1, "I", "  settingDebugLevel=" + mEnvParms.settingDebugLevel);
        mGlblParms.util.addDebugMsg(1, "I", "  settingLogMsgDir=" + mEnvParms.settingLogMsgDir);
        mGlblParms.util.addDebugMsg(1, "I", "  settingLogOption=" + mEnvParms.settingLogOption);
        mGlblParms.util.addDebugMsg(1, "I", "  settingEnableScheduler=" + mEnvParms.settingEnableScheduler);
        mGlblParms.util.addDebugMsg(1, "I", "  settingMaxTaskCount=" + mEnvParms.settingMaxTaskCount);
        mGlblParms.util.addDebugMsg(1, "I",
                "  settingThreadPoolCount=" + mEnvParms.settingTaskExecThreadPoolCount);
        mGlblParms.util.addDebugMsg(1, "I", "  settingRestartScheduler=" + restart_scheduler);
        mGlblParms.util.addDebugMsg(1, "I", "  settingEnableMonitor=" + mEnvParms.settingEnableMonitor);
        mGlblParms.util.addDebugMsg(1, "I", "  settingForceWakeLockUse=" + mEnvParms.settingForceWakeLockUse);
        mGlblParms.util.addDebugMsg(1, "I", "  settingHeartBeatIntervalTime=" + mEnvParms.settingSleepOption);
        mGlblParms.util.addDebugMsg(1, "I", "  settingExitClean=" + mEnvParms.settingExitClean);

        mGlblParms.util.resetLogReceiver();

        if (getPrefsMgr().getBoolean(getString(R.string.settings_main_sample_recreate), false)) {
            getPrefsMgr().edit().putBoolean(getString(R.string.settings_main_sample_recreate), false).commit();
            boolean sample = ProfileUtilities.isProfileGroupActive(mGlblParms.util, mGlblParms.profileAdapter,
                    "Sample");
            boolean bsh = ProfileUtilities.isProfileGroupActive(mGlblParms.util, mGlblParms.profileAdapter,
                    "BeanShell API Sample");
            ProfileUtilities.deleteProfileGroup(mGlblParms.util, mGlblParms.profileAdapter, "Sample");
            ProfileUtilities.deleteProfileGroup(mGlblParms.util, mGlblParms.profileAdapter,
                    "BeanShell API Sample");
            SampleProfile.addSampleProfile(mGlblParms.profileAdapter, true, true);

            mGlblParms.profileAdapter.sort();
            mGlblParms.profileAdapter.updateShowList();
            mGlblParms.profileAdapter.notifyDataSetChanged();
            if (sample || bsh)
                ProfileMaintenance.putProfileListToService(mGlblParms, mGlblParms.profileAdapter, true);
            else
                ProfileMaintenance.putProfileListToService(mGlblParms, mGlblParms.profileAdapter, false);

            createProfileGroupList();
            setProfileGroupSelectorListener();
            setProfileGroupTabListClickListener();
            setProfileGroupTabListLongClickListener();
            setProfileFilterSelectorListener();

        }

        if (restart_scheduler || p_tpc != n_tpc || !p_intvl.equals(n_intvl)
                || isBooleanDifferent(p_light_sensor_thread, mEnvParms.settingLightSensorUseThread)) {
            if (!pms && mEnvParms.settingEnableScheduler)
                mGlblParms.util.startScheduler();
            //            mGlblParms.util.restartScheduler();
            Intent in_b = new Intent(mContext.getApplicationContext(), ActivityRestartScheduler.class);
            in_b.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(in_b);
        } else {
            if (!pms && mEnvParms.settingEnableScheduler)
                mGlblParms.util.startScheduler();
            mSvcServer.aidlResetScheduler();
        }

        setSchedulerStatus();
        setControlTabListener();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:info.guardianproject.otr.app.im.app.ChatView.java

private void showPromptForData(String transferFrom, String filePath) {
    AlertDialog.Builder builder = new AlertDialog.Builder(mNewChatActivity);

    builder.setTitle(mContext.getString(R.string.file_transfer));
    builder.setMessage(transferFrom + ' ' + mNewChatActivity.getString(R.string.wants_to_send_you_the_file)
            + " '" + filePath + "'. " + mNewChatActivity.getString(R.string.accept_transfer_));

    builder.setNeutralButton(R.string.button_yes_accept_all, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {

            try {
                mCurrentChatSession.setIncomingFileResponse(true, true);
            } catch (RemoteException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }//w w  w  .java  2 s  . c o  m

            dialog.dismiss();
        }

    });

    builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            try {
                mCurrentChatSession.setIncomingFileResponse(true, false);
            } catch (RemoteException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            dialog.dismiss();
        }

    });

    builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            try {
                mCurrentChatSession.setIncomingFileResponse(false, false);
            } catch (RemoteException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            // Do nothing
            dialog.dismiss();
        }
    });

    AlertDialog alert = builder.create();
    alert.show();

}

From source file:com.nbplus.iotlib.IoTInterface.java

private void sendMessageToService(int what, Bundle b) {
    // Now that we have the service messenger, lets send our messenger
    Message msg = new Message();
    msg.what = what;//w w  w. j  av  a2s  . c  om

    /*
     * In case we would want to send extra data, we could use Bundles:
     * Bundle b = new Bundle(); b.putString("key", "hello world");
     * msg.setData(b);
     */
    if (b == null) {
        b = new Bundle();

        IoTHandleData data = new IoTHandleData();
        b.putParcelable(IoTServiceCommand.KEY_DATA, data);
    }
    b.putString(IoTServiceCommand.KEY_MSGID, IoTServiceCommand.generateMessageId(mCtx));
    msg.setData(b);

    try {
        mServiceMessenger.send(msg);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}