Added changes to the maven archetype

revert-dabc3590
harshanL 10 years ago
parent 73e73e8f53
commit 73359d4b95

@ -80,7 +80,7 @@ public class Operation {
try { try {
dmService = AndroidAPIUtils.getDeviceManagementService(); dmService = AndroidAPIUtils.getDeviceManagementService();
//TODO: need to complete getOperation logic //TODO: need to complete updateOperation logic
boolean result = dmService.getOperationManager("").addOperation(null, null); boolean result = dmService.getOperationManager("").addOperation(null, null);
if (result) { if (result) {
Response.status(HttpStatus.SC_OK); Response.status(HttpStatus.SC_OK);

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wso2.cdm.agent"
android:sharedUserId="org.wso2.cdm.agent"
android:sharedUserLabel="@string/hello_world"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--
Creates a custom permission so only this app can receive its messages.
NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application's package name.
-->
<permission
android:name="org.wso2.emm.agent.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="org.wso2.emm.agent.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
</uses-permission>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.SEND_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" >
</uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
<activity
android:name="org.wso2.cdm.agent.RegistrationActivity"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
</activity>
<activity
android:name="org.wso2.cdm.agent.DisplayDeviceInfoActivity"
android:label="@string/title_activity_display_device_info"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.RegisterSuccessfulActivity"
android:label="@string/title_activity_register_successful"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<!-- Begin List of Receivers -->
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="org.wso2.emm.agent" />
</intent-filter>
</receiver>
<receiver
android:name="org.wso2.cdm.agent.services.WSO2DeviceAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN" >
<intent-filter>
<!-- This action is required -->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<!-- This is required this receiver to become device admin component. -->
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/wso2_device_admin" >
</meta-data>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.AlarmReceiver"></receiver>
<receiver android:name="org.wso2.cdm.agent.services.DeviceStartupIntentReceiver" android:enabled="true" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!-- End List of Receivers -->
<service android:name="org.wso2.cdm.agent.GCMIntentService" />
<activity
android:name="org.wso2.cdm.agent.AlreadyRegisteredActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationErrorActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.NotifyActivity"
android:label="@string/title_activity_notify"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.ServerDetails"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.wso2.cdm.agent.PinCodeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.Notification"
android:label="@string/title_activity_notification"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AlertActivity"
android:label="@string/title_activity_alert"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name="org.wso2.cdm.agent.LogActivity"
android:label="@string/title_activity_log"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>

@ -0,0 +1,911 @@
int attr actionBarDivider 0x7f01000e
int attr actionBarItemBackground 0x7f01000f
int attr actionBarSize 0x7f01000d
int attr actionBarSplitStyle 0x7f01000b
int attr actionBarStyle 0x7f01000a
int attr actionBarTabBarStyle 0x7f010007
int attr actionBarTabStyle 0x7f010006
int attr actionBarTabTextStyle 0x7f010008
int attr actionBarWidgetTheme 0x7f01000c
int attr actionButtonStyle 0x7f01003a
int attr actionDropDownStyle 0x7f010039
int attr actionMenuTextAppearance 0x7f010010
int attr actionMenuTextColor 0x7f010011
int attr actionModeBackground 0x7f010014
int attr actionModeCloseButtonStyle 0x7f010013
int attr actionModeCloseDrawable 0x7f010016
int attr actionModePopupWindowStyle 0x7f010018
int attr actionModeShareDrawable 0x7f010017
int attr actionModeSplitBackground 0x7f010015
int attr actionModeStyle 0x7f010012
int attr actionOverflowButtonStyle 0x7f010009
int attr actionSpinnerItemStyle 0x7f01003f
int attr activatedBackgroundIndicator 0x7f010047
int attr activityChooserViewStyle 0x7f010046
int attr background 0x7f010002
int attr backgroundSplit 0x7f010003
int attr backgroundStacked 0x7f01004e
int attr buttonStyleSmall 0x7f010019
int attr customNavigationLayout 0x7f01004f
int attr displayOptions 0x7f010049
int attr divider 0x7f010005
int attr dividerVertical 0x7f010038
int attr dropDownListViewStyle 0x7f01003c
int attr dropdownListPreferredItemHeight 0x7f01003e
int attr expandActivityOverflowButtonDrawable 0x7f01005e
int attr headerBackground 0x7f010058
int attr height 0x7f010004
int attr homeAsUpIndicator 0x7f01003b
int attr homeLayout 0x7f010050
int attr horizontalDivider 0x7f010056
int attr icon 0x7f01004c
int attr iconifiedByDefault 0x7f01005f
int attr indeterminateProgressStyle 0x7f010052
int attr initialActivityCount 0x7f01005d
int attr itemBackground 0x7f010059
int attr itemIconDisabledAlpha 0x7f01005b
int attr itemPadding 0x7f010054
int attr itemTextAppearance 0x7f010055
int attr listPopupWindowStyle 0x7f010045
int attr listPreferredItemHeightSmall 0x7f010032
int attr listPreferredItemPaddingLeft 0x7f010033
int attr listPreferredItemPaddingRight 0x7f010034
int attr logo 0x7f01004d
int attr navigationMode 0x7f010048
int attr popupMenuStyle 0x7f01003d
int attr preserveIconSpacing 0x7f01005c
int attr progressBarPadding 0x7f010053
int attr progressBarStyle 0x7f010051
int attr queryHint 0x7f010060
int attr searchAutoCompleteTextView 0x7f010024
int attr searchDropdownBackground 0x7f010025
int attr searchResultListItemHeight 0x7f01002f
int attr searchViewCloseIcon 0x7f010026
int attr searchViewEditQuery 0x7f01002a
int attr searchViewEditQueryBackground 0x7f01002b
int attr searchViewGoIcon 0x7f010027
int attr searchViewSearchIcon 0x7f010028
int attr searchViewTextField 0x7f01002c
int attr searchViewTextFieldRight 0x7f01002d
int attr searchViewVoiceIcon 0x7f010029
int attr selectableItemBackground 0x7f01001a
int attr spinnerDropDownItemStyle 0x7f010023
int attr spinnerItemStyle 0x7f010022
int attr subtitle 0x7f01004b
int attr subtitleTextStyle 0x7f010001
int attr textAppearanceLargePopupMenu 0x7f01001c
int attr textAppearanceListItemSmall 0x7f010035
int attr textAppearanceSearchResultSubtitle 0x7f010031
int attr textAppearanceSearchResultTitle 0x7f010030
int attr textAppearanceSmall 0x7f01001e
int attr textAppearanceSmallPopupMenu 0x7f01001d
int attr textColorPrimary 0x7f01001f
int attr textColorPrimaryDisableOnly 0x7f010020
int attr textColorPrimaryInverse 0x7f010021
int attr textColorSearchUrl 0x7f01002e
int attr title 0x7f01004a
int attr titleTextStyle 0x7f010000
int attr verticalDivider 0x7f010057
int attr windowActionBar 0x7f010041
int attr windowActionBarOverlay 0x7f010042
int attr windowActionModeOverlay 0x7f010043
int attr windowAnimationStyle 0x7f01005a
int attr windowContentOverlay 0x7f01001b
int attr windowMinWidthMajor 0x7f010036
int attr windowMinWidthMinor 0x7f010037
int attr windowNoTitle 0x7f010040
int attr windowSplitActionBar 0x7f010044
int bool abs__action_bar_embed_tabs 0x7f070000
int bool abs__action_bar_expanded_action_views_exclusive 0x7f070002
int bool abs__config_actionMenuItemAllCaps 0x7f070004
int bool abs__config_allowActionMenuItemTextWithIcon 0x7f070005
int bool abs__config_showMenuShortcutsWhenKeyboardPresent 0x7f070003
int bool abs__split_action_bar_is_narrow 0x7f070001
int color abs__background_holo_dark 0x7f080000
int color abs__background_holo_light 0x7f080001
int color abs__bright_foreground_disabled_holo_dark 0x7f080004
int color abs__bright_foreground_disabled_holo_light 0x7f080005
int color abs__bright_foreground_holo_dark 0x7f080002
int color abs__bright_foreground_holo_light 0x7f080003
int color abs__bright_foreground_inverse_holo_dark 0x7f080006
int color abs__bright_foreground_inverse_holo_light 0x7f080007
int color abs__holo_blue_light 0x7f080008
int color abs__primary_text_disable_only_holo_dark 0x7f08000c
int color abs__primary_text_disable_only_holo_light 0x7f08000d
int color abs__primary_text_holo_dark 0x7f08000e
int color abs__primary_text_holo_light 0x7f08000f
int color black 0x7f08000b
int color light_grey 0x7f080009
int color white 0x7f08000a
int dimen abs__action_bar_default_height 0x7f090001
int dimen abs__action_bar_icon_vertical_padding 0x7f090002
int dimen abs__action_bar_subtitle_bottom_margin 0x7f090006
int dimen abs__action_bar_subtitle_text_size 0x7f090004
int dimen abs__action_bar_subtitle_top_margin 0x7f090005
int dimen abs__action_bar_title_text_size 0x7f090003
int dimen abs__action_button_min_width 0x7f090007
int dimen abs__alert_dialog_title_height 0x7f090008
int dimen abs__config_prefDialogWidth 0x7f090000
int dimen abs__dialog_min_width_major 0x7f090009
int dimen abs__dialog_min_width_minor 0x7f09000a
int dimen abs__dropdownitem_icon_width 0x7f09000d
int dimen abs__dropdownitem_text_padding_left 0x7f09000b
int dimen abs__dropdownitem_text_padding_right 0x7f09000c
int dimen abs__search_view_preferred_width 0x7f09000f
int dimen abs__search_view_text_min_width 0x7f09000e
int dimen action_button_min_width 0x7f090010
int dimen activity_horizontal_margin 0x7f090011
int dimen activity_vertical_margin 0x7f090012
int dimen top_bar_height 0x7f090013
int drawable abs__ab_bottom_solid_dark_holo 0x7f020000
int drawable abs__ab_bottom_solid_inverse_holo 0x7f020001
int drawable abs__ab_bottom_solid_light_holo 0x7f020002
int drawable abs__ab_bottom_transparent_dark_holo 0x7f020003
int drawable abs__ab_bottom_transparent_light_holo 0x7f020004
int drawable abs__ab_share_pack_holo_dark 0x7f020005
int drawable abs__ab_share_pack_holo_light 0x7f020006
int drawable abs__ab_solid_dark_holo 0x7f020007
int drawable abs__ab_solid_light_holo 0x7f020008
int drawable abs__ab_solid_shadow_holo 0x7f020009
int drawable abs__ab_stacked_solid_dark_holo 0x7f02000a
int drawable abs__ab_stacked_solid_light_holo 0x7f02000b
int drawable abs__ab_stacked_transparent_dark_holo 0x7f02000c
int drawable abs__ab_stacked_transparent_light_holo 0x7f02000d
int drawable abs__ab_transparent_dark_holo 0x7f02000e
int drawable abs__ab_transparent_light_holo 0x7f02000f
int drawable abs__activated_background_holo_dark 0x7f020010
int drawable abs__activated_background_holo_light 0x7f020011
int drawable abs__btn_cab_done_default_holo_dark 0x7f020012
int drawable abs__btn_cab_done_default_holo_light 0x7f020013
int drawable abs__btn_cab_done_focused_holo_dark 0x7f020014
int drawable abs__btn_cab_done_focused_holo_light 0x7f020015
int drawable abs__btn_cab_done_holo_dark 0x7f020016
int drawable abs__btn_cab_done_holo_light 0x7f020017
int drawable abs__btn_cab_done_pressed_holo_dark 0x7f020018
int drawable abs__btn_cab_done_pressed_holo_light 0x7f020019
int drawable abs__cab_background_bottom_holo_dark 0x7f02001a
int drawable abs__cab_background_bottom_holo_light 0x7f02001b
int drawable abs__cab_background_top_holo_dark 0x7f02001c
int drawable abs__cab_background_top_holo_light 0x7f02001d
int drawable abs__dialog_full_holo_dark 0x7f02001e
int drawable abs__dialog_full_holo_light 0x7f02001f
int drawable abs__ic_ab_back_holo_dark 0x7f020020
int drawable abs__ic_ab_back_holo_light 0x7f020021
int drawable abs__ic_cab_done_holo_dark 0x7f020022
int drawable abs__ic_cab_done_holo_light 0x7f020023
int drawable abs__ic_clear 0x7f020024
int drawable abs__ic_clear_disabled 0x7f020025
int drawable abs__ic_clear_holo_light 0x7f020026
int drawable abs__ic_clear_normal 0x7f020027
int drawable abs__ic_clear_search_api_disabled_holo_light 0x7f020028
int drawable abs__ic_clear_search_api_holo_light 0x7f020029
int drawable abs__ic_go 0x7f02002a
int drawable abs__ic_go_search_api_holo_light 0x7f02002b
int drawable abs__ic_menu_moreoverflow_holo_dark 0x7f02002c
int drawable abs__ic_menu_moreoverflow_holo_light 0x7f02002d
int drawable abs__ic_menu_moreoverflow_normal_holo_dark 0x7f02002e
int drawable abs__ic_menu_moreoverflow_normal_holo_light 0x7f02002f
int drawable abs__ic_menu_share_holo_dark 0x7f020030
int drawable abs__ic_menu_share_holo_light 0x7f020031
int drawable abs__ic_search 0x7f020032
int drawable abs__ic_search_api_holo_light 0x7f020033
int drawable abs__ic_voice_search 0x7f020034
int drawable abs__ic_voice_search_api_holo_light 0x7f020035
int drawable abs__item_background_holo_dark 0x7f020036
int drawable abs__item_background_holo_light 0x7f020037
int drawable abs__list_activated_holo 0x7f020038
int drawable abs__list_divider_holo_dark 0x7f020039
int drawable abs__list_divider_holo_light 0x7f02003a
int drawable abs__list_focused_holo 0x7f02003b
int drawable abs__list_longpressed_holo 0x7f02003c
int drawable abs__list_pressed_holo_dark 0x7f02003d
int drawable abs__list_pressed_holo_light 0x7f02003e
int drawable abs__list_selector_background_transition_holo_dark 0x7f02003f
int drawable abs__list_selector_background_transition_holo_light 0x7f020040
int drawable abs__list_selector_disabled_holo_dark 0x7f020041
int drawable abs__list_selector_disabled_holo_light 0x7f020042
int drawable abs__list_selector_holo_dark 0x7f020043
int drawable abs__list_selector_holo_light 0x7f020044
int drawable abs__menu_dropdown_panel_holo_dark 0x7f020045
int drawable abs__menu_dropdown_panel_holo_light 0x7f020046
int drawable abs__progress_bg_holo_dark 0x7f020047
int drawable abs__progress_bg_holo_light 0x7f020048
int drawable abs__progress_horizontal_holo_dark 0x7f020049
int drawable abs__progress_horizontal_holo_light 0x7f02004a
int drawable abs__progress_medium_holo 0x7f02004b
int drawable abs__progress_primary_holo_dark 0x7f02004c
int drawable abs__progress_primary_holo_light 0x7f02004d
int drawable abs__progress_secondary_holo_dark 0x7f02004e
int drawable abs__progress_secondary_holo_light 0x7f02004f
int drawable abs__search_dropdown_dark 0x7f020050
int drawable abs__search_dropdown_light 0x7f020051
int drawable abs__spinner_48_inner_holo 0x7f020052
int drawable abs__spinner_48_outer_holo 0x7f020053
int drawable abs__spinner_ab_default_holo_dark 0x7f020054
int drawable abs__spinner_ab_default_holo_light 0x7f020055
int drawable abs__spinner_ab_disabled_holo_dark 0x7f020056
int drawable abs__spinner_ab_disabled_holo_light 0x7f020057
int drawable abs__spinner_ab_focused_holo_dark 0x7f020058
int drawable abs__spinner_ab_focused_holo_light 0x7f020059
int drawable abs__spinner_ab_holo_dark 0x7f02005a
int drawable abs__spinner_ab_holo_light 0x7f02005b
int drawable abs__spinner_ab_pressed_holo_dark 0x7f02005c
int drawable abs__spinner_ab_pressed_holo_light 0x7f02005d
int drawable abs__tab_indicator_ab_holo 0x7f02005e
int drawable abs__tab_selected_focused_holo 0x7f02005f
int drawable abs__tab_selected_holo 0x7f020060
int drawable abs__tab_selected_pressed_holo 0x7f020061
int drawable abs__tab_unselected_pressed_holo 0x7f020062
int drawable abs__textfield_search_default_holo_dark 0x7f020063
int drawable abs__textfield_search_default_holo_light 0x7f020064
int drawable abs__textfield_search_right_default_holo_dark 0x7f020065
int drawable abs__textfield_search_right_default_holo_light 0x7f020066
int drawable abs__textfield_search_right_selected_holo_dark 0x7f020067
int drawable abs__textfield_search_right_selected_holo_light 0x7f020068
int drawable abs__textfield_search_selected_holo_dark 0x7f020069
int drawable abs__textfield_search_selected_holo_light 0x7f02006a
int drawable abs__textfield_searchview_holo_dark 0x7f02006b
int drawable abs__textfield_searchview_holo_light 0x7f02006c
int drawable abs__textfield_searchview_right_holo_dark 0x7f02006d
int drawable abs__textfield_searchview_right_holo_light 0x7f02006e
int drawable appinstall 0x7f02006f
int drawable applist 0x7f020070
int drawable appuninstall 0x7f020071
int drawable btn_grey 0x7f020072
int drawable btn_orange 0x7f020073
int drawable camera 0x7f020074
int drawable changepassword 0x7f020075
int drawable custom_checkbox 0x7f020076
int drawable dot 0x7f020077
int drawable encrypt 0x7f020078
int drawable ic_bookmark 0x7f020079
int drawable ic_check_default 0x7f02007a
int drawable ic_check_selected 0x7f02007b
int drawable ic_launcher 0x7f02007c
int drawable ic_logo 0x7f02007d
int drawable ic_logo_dark 0x7f02007e
int drawable ic_stat_gcm 0x7f02007f
int drawable info 0x7f020080
int drawable location 0x7f020081
int drawable lock 0x7f020082
int drawable mdm_logo 0x7f020083
int drawable mute 0x7f020084
int drawable notification 0x7f020085
int drawable option_icon 0x7f020086
int drawable repeat_bg 0x7f020087
int drawable top_bar 0x7f020088
int drawable wifi 0x7f020089
int drawable wipe 0x7f02008a
int id TextView01 0x7f060091
int id abs__action_bar 0x7f06004e
int id abs__action_bar_container 0x7f06004d
int id abs__action_bar_subtitle 0x7f06003d
int id abs__action_bar_title 0x7f06003c
int id abs__action_context_bar 0x7f06004f
int id abs__action_menu_divider 0x7f06000c
int id abs__action_menu_presenter 0x7f06000d
int id abs__action_mode_bar 0x7f060052
int id abs__action_mode_bar_stub 0x7f060051
int id abs__action_mode_close_button 0x7f060040
int id abs__activity_chooser_view_content 0x7f060041
int id abs__checkbox 0x7f06004a
int id abs__content 0x7f060049
int id abs__default_activity_button 0x7f060044
int id abs__expand_activities_button 0x7f060042
int id abs__home 0x7f06000a
int id abs__icon 0x7f060046
int id abs__image 0x7f060043
int id abs__imageButton 0x7f06003e
int id abs__list_item 0x7f060045
int id abs__progress_circular 0x7f06000e
int id abs__progress_horizontal 0x7f06000f
int id abs__radio 0x7f06004c
int id abs__search_badge 0x7f060055
int id abs__search_bar 0x7f060054
int id abs__search_button 0x7f060056
int id abs__search_close_btn 0x7f06005b
int id abs__search_edit_frame 0x7f060057
int id abs__search_go_btn 0x7f06005d
int id abs__search_mag_icon 0x7f060058
int id abs__search_plate 0x7f060059
int id abs__search_src_text 0x7f06005a
int id abs__search_voice_btn 0x7f06005e
int id abs__shortcut 0x7f06004b
int id abs__split_action_bar 0x7f060050
int id abs__submit_area 0x7f06005c
int id abs__textButton 0x7f06003f
int id abs__title 0x7f060047
int id abs__titleDivider 0x7f060048
int id abs__up 0x7f06000b
int id action_settings 0x7f060095
int id background_container 0x7f06001f
int id blocks_now 0x7f06001e
int id blocks_ruler 0x7f06001d
int id btnEnroll 0x7f060082
int id btnLogin 0x7f060090
int id btnOK 0x7f060064
int id btnRefresh 0x7f06007d
int id btnRegister 0x7f060070
int id btnReset 0x7f06007e
int id btnSetPin 0x7f060087
int id btnStartRegistration 0x7f06008b
int id btnTryAgain 0x7f060073
int id btnUnreg 0x7f060065
int id btnUnregister 0x7f060088
int id button_layout 0x7f06008d
int id debug_log 0x7f06009b
int id dialogButtonCancel 0x7f06008f
int id dialogButtonOK 0x7f06008e
int id dialog_discard_confirm 0x7f06001a
int id dialog_moderator 0x7f06001b
int id dialog_wave 0x7f06001c
int id disableHome 0x7f060009
int id edit_query 0x7f060053
int id enrollPanel 0x7f060081
int id error 0x7f060072
int id etDomain 0x7f06006a
int id etPassword 0x7f06006c
int id etUsername 0x7f06006b
int id evServerIP 0x7f06008a
int id footer 0x7f060071
int id footerlogo 0x7f060068
int id fragment_container 0x7f060034
int id gridview 0x7f060014
int id homeAsUp 0x7f060006
int id incompatibleError 0x7f060074
int id info 0x7f060098
int id info_setting 0x7f060099
int id ip_setting 0x7f060097
int id layout_topbar 0x7f060067
int id lblPin 0x7f060084
int id linInner 0x7f060062
int id linearLayout1 0x7f060069
int id linearLayoutText 0x7f060080
int id listMode 0x7f060002
int id listview 0x7f060060
int id logo 0x7f06005f
int id more 0x7f060096
int id normal 0x7f060001
int id notify 0x7f060092
int id option_button 0x7f06007c
int id pin_setting 0x7f06009a
int id preference_brand_view 0x7f06002d
int id preference_empty_view 0x7f06002c
int id radioBYOD 0x7f06006e
int id radioCOPE 0x7f06006f
int id radioGroupType 0x7f06006d
int id rowImage 0x7f060093
int id rowTextView 0x7f060094
int id scroller 0x7f060061
int id setting_invite_email_button 0x7f060030
int id setting_invite_email_edittext 0x7f06002f
int id setting_invite_email_imageview 0x7f060031
int id setting_invite_email_layout 0x7f06002e
int id setting_invite_email_textview 0x7f060032
int id sg_button1 0x7f060039
int id sg_button2 0x7f06003a
int id sg_button3 0x7f06003b
int id sg_category_popup 0x7f060035
int id sg_city 0x7f060038
int id sg_tag_command 0x7f060036
int id sg_tag_payload 0x7f060037
int id showCustom 0x7f060008
int id showHome 0x7f060005
int id showTitle 0x7f060007
int id sp_edittext_city 0x7f060025
int id sp_edittext_email 0x7f060023
int id sp_edittext_location 0x7f060022
int id sp_edittext_name 0x7f060021
int id sp_edittext_other 0x7f06002a
int id sp_edittext_phone 0x7f060029
int id sp_edittext_state 0x7f060026
int id sp_edittext_street 0x7f060024
int id sp_edittext_zipcode 0x7f060027
int id sp_textview_country 0x7f060028
int id sp_textview_gpspick 0x7f06002b
int id startRegistration 0x7f060083
int id swipeable 0x7f060013
int id swipeable_bottom 0x7f060010
int id swipeable_container 0x7f060012
int id swipeable_top 0x7f060011
int id tabMode 0x7f060003
int id text 0x7f06008c
int id title_bar_layout 0x7f060020
int id title_container 0x7f060016
int id title_logo 0x7f060017
int id title_option 0x7f060019
int id title_text 0x7f060018
int id tvSeverAddress 0x7f060089
int id txtDevice 0x7f060076
int id txtId 0x7f060075
int id txtLog 0x7f06007f
int id txtMessage 0x7f060063
int id txtModel 0x7f060077
int id txtOS 0x7f06007a
int id txtOldPinCode 0x7f060085
int id txtOperator 0x7f060078
int id txtPinCode 0x7f060086
int id txtRegText 0x7f060066
int id txtRoot 0x7f06007b
int id txtSDK 0x7f060079
int id useLogo 0x7f060004
int id user_edit_location 0x7f060033
int id webview 0x7f060015
int id wrap_content 0x7f060000
int integer abs__max_action_buttons 0x7f0a0000
int layout abs__action_bar_home 0x7f030000
int layout abs__action_bar_tab 0x7f030001
int layout abs__action_bar_tab_bar_view 0x7f030002
int layout abs__action_bar_title_item 0x7f030003
int layout abs__action_menu_item_layout 0x7f030004
int layout abs__action_menu_layout 0x7f030005
int layout abs__action_mode_bar 0x7f030006
int layout abs__action_mode_close_item 0x7f030007
int layout abs__activity_chooser_view 0x7f030008
int layout abs__activity_chooser_view_list_item 0x7f030009
int layout abs__dialog_title_holo 0x7f03000a
int layout abs__list_menu_item_checkbox 0x7f03000b
int layout abs__list_menu_item_icon 0x7f03000c
int layout abs__list_menu_item_layout 0x7f03000d
int layout abs__list_menu_item_radio 0x7f03000e
int layout abs__popup_menu_item_layout 0x7f03000f
int layout abs__screen_action_bar 0x7f030010
int layout abs__screen_action_bar_overlay 0x7f030011
int layout abs__screen_simple 0x7f030012
int layout abs__screen_simple_overlay_action_mode 0x7f030013
int layout abs__search_dropdown_item_icons_2line 0x7f030014
int layout abs__search_view 0x7f030015
int layout abs__simple_dropdown_hint 0x7f030016
int layout activity_agent_settings 0x7f030017
int layout activity_alert 0x7f030018
int layout activity_already_registered 0x7f030019
int layout activity_authentication 0x7f03001a
int layout activity_authentication_error 0x7f03001b
int layout activity_available_operations 0x7f03001c
int layout activity_display_device_info 0x7f03001d
int layout activity_entry 0x7f03001e
int layout activity_log 0x7f03001f
int layout activity_main 0x7f030020
int layout activity_notification 0x7f030021
int layout activity_pin_code 0x7f030022
int layout activity_register_successful 0x7f030023
int layout activity_settings 0x7f030024
int layout custom_sherlock_bar 0x7f030025
int layout custom_terms_popup 0x7f030026
int layout footer_repeat 0x7f030027
int layout header_gradient 0x7f030028
int layout login 0x7f030029
int layout main 0x7f03002a
int layout notify 0x7f03002b
int layout row_with_icon 0x7f03002c
int layout sherlock_spinner_dropdown_item 0x7f03002d
int layout sherlock_spinner_item 0x7f03002e
int layout simplerow 0x7f03002f
int menu agent_settings 0x7f0d0000
int menu alert 0x7f0d0001
int menu all_ready_registered 0x7f0d0002
int menu auth_sherlock_menu 0x7f0d0003
int menu authentication 0x7f0d0004
int menu authentication_error 0x7f0d0005
int menu available_operations 0x7f0d0006
int menu display_device_info 0x7f0d0007
int menu entry 0x7f0d0008
int menu log 0x7f0d0009
int menu main 0x7f0d000a
int menu notification 0x7f0d000b
int menu notify 0x7f0d000c
int menu options_menu 0x7f0d000d
int menu pin_code 0x7f0d000e
int menu register_successful 0x7f0d000f
int menu settings 0x7f0d0010
int menu sherlock_menu 0x7f0d0011
int menu sherlock_menu_debug 0x7f0d0012
int raw emm_truststore 0x7f050000
int string abs__action_bar_home_description 0x7f0b0000
int string abs__action_bar_up_description 0x7f0b0001
int string abs__action_menu_overflow_description 0x7f0b0002
int string abs__action_mode_done 0x7f0b0003
int string abs__activity_chooser_view_dialog_title_default 0x7f0b0005
int string abs__activity_chooser_view_see_all 0x7f0b0004
int string abs__activitychooserview_choose_application 0x7f0b0007
int string abs__searchview_description_clear 0x7f0b000c
int string abs__searchview_description_query 0x7f0b000b
int string abs__searchview_description_search 0x7f0b000a
int string abs__searchview_description_submit 0x7f0b000d
int string abs__searchview_description_voice 0x7f0b000e
int string abs__share_action_provider_share_with 0x7f0b0006
int string abs__shareactionprovider_share_with 0x7f0b0008
int string abs__shareactionprovider_share_with_application 0x7f0b0009
int string action_settings 0x7f0b0025
int string already_registered 0x7f0b0012
int string app_name 0x7f0b0023
int string application_mgr_download_file_name 0x7f0b0097
int string application_mgr_download_location 0x7f0b0096
int string application_mgr_mime 0x7f0b0098
int string application_package_launcher_action 0x7f0b009a
int string application_package_prefix 0x7f0b0099
int string button_cancel 0x7f0b0095
int string button_ok 0x7f0b0094
int string client_id 0x7f0b000f
int string client_secret 0x7f0b0010
int string device_admin_disabled 0x7f0b0030
int string device_admin_enable_alert 0x7f0b003f
int string device_admin_enabled 0x7f0b002f
int string device_compatible 0x7f0b0033
int string device_enroll_type_byod 0x7f0b0040
int string device_enroll_type_cope 0x7f0b0041
int string device_not_compatible_error 0x7f0b0031
int string device_not_compatible_error_os 0x7f0b0032
int string device_not_compatible_error_root 0x7f0b0034
int string dialog_authenticate 0x7f0b0075
int string dialog_checking_reg 0x7f0b0077
int string dialog_enrolling 0x7f0b007a
int string dialog_init_confirmation 0x7f0b007d
int string dialog_init_device_type 0x7f0b007f
int string dialog_init_end 0x7f0b0080
int string dialog_init_end_general 0x7f0b0081
int string dialog_init_middle 0x7f0b007e
int string dialog_license_agreement 0x7f0b0079
int string dialog_message_please_wait 0x7f0b0089
int string dialog_message_unregistering 0x7f0b0088
int string dialog_pin_confirmation 0x7f0b007b
int string dialog_pin_confirmation_end 0x7f0b007c
int string dialog_please_wait 0x7f0b0076
int string dialog_sender_id 0x7f0b0078
int string dialog_unregister 0x7f0b0082
int string empty_app_title 0x7f0b0024
int string error_auth_failed_detail 0x7f0b006c
int string error_authentication_failed 0x7f0b006d
int string error_authorization_failed 0x7f0b0069
int string error_config 0x7f0b0011
int string error_connect_to_server 0x7f0b0065
int string error_enrollment_failed 0x7f0b006a
int string error_enrollment_failed_detail 0x7f0b006b
int string error_for_all_unknown_authentication_failures 0x7f0b0070
int string error_for_all_unknown_notification_failures 0x7f0b0072
int string error_for_all_unknown_registration_failures 0x7f0b006f
int string error_for_all_unknown_unregister_failures 0x7f0b0071
int string error_heading_connection 0x7f0b0066
int string error_internal_server 0x7f0b0073
int string error_invalid_server_address 0x7f0b0074
int string error_network_unavailable 0x7f0b006e
int string error_registration_failed 0x7f0b0067
int string error_unregistration_failed 0x7f0b0068
int string gcm_deleted 0x7f0b0018
int string gcm_error 0x7f0b0016
int string gcm_message 0x7f0b0015
int string gcm_recoverable_error 0x7f0b0017
int string gcm_registered 0x7f0b0013
int string gcm_unregistered 0x7f0b0014
int string hello_world 0x7f0b0026
int string hint_new_pin 0x7f0b0045
int string info_label_device 0x7f0b008b
int string info_label_imei 0x7f0b008a
int string info_label_imsi 0x7f0b008f
int string info_label_model 0x7f0b008c
int string info_label_no_sim 0x7f0b008d
int string info_label_operator 0x7f0b008e
int string info_label_os 0x7f0b0090
int string info_label_rooted 0x7f0b0091
int string intent_extra_fresh_reg_flag 0x7f0b004f
int string intent_extra_from_activity 0x7f0b004b
int string intent_extra_main_activity 0x7f0b004d
int string intent_extra_message 0x7f0b004e
int string intent_extra_notification 0x7f0b0051
int string intent_extra_regid 0x7f0b004c
int string intent_extra_username 0x7f0b0050
int string menu_item_change_ip 0x7f0b0087
int string menu_item_change_pin 0x7f0b0086
int string menu_item_ip 0x7f0b003c
int string menu_item_log 0x7f0b003d
int string menu_item_operations 0x7f0b003a
int string menu_item_phone_info 0x7f0b0085
int string menu_item_pin 0x7f0b003b
int string no 0x7f0b0093
int string options_clear 0x7f0b0021
int string options_exit 0x7f0b0022
int string options_register 0x7f0b001e
int string options_unregister 0x7f0b001f
int string register_button_text 0x7f0b0083
int string register_text_view_text_unregister 0x7f0b0084
int string registration_heading 0x7f0b009e
int string server_register_error 0x7f0b001c
int string server_registered 0x7f0b001a
int string server_registering 0x7f0b0019
int string server_unregister_error 0x7f0b001d
int string server_unregistered 0x7f0b001b
int string server_util_req_type_get 0x7f0b009c
int string server_util_req_type_post 0x7f0b009b
int string shared_pref_client_id 0x7f0b0063
int string shared_pref_client_secret 0x7f0b0064
int string shared_pref_device_active 0x7f0b0062
int string shared_pref_eula 0x7f0b0057
int string shared_pref_interval 0x7f0b0060
int string shared_pref_ip 0x7f0b0056
int string shared_pref_isagreed 0x7f0b0054
int string shared_pref_message_mode 0x7f0b005f
int string shared_pref_package 0x7f0b0052
int string shared_pref_pin 0x7f0b005a
int string shared_pref_policy 0x7f0b0053
int string shared_pref_regId 0x7f0b0058
int string shared_pref_reg_fail 0x7f0b005c
int string shared_pref_reg_success 0x7f0b005b
int string shared_pref_reg_type 0x7f0b005d
int string shared_pref_registered 0x7f0b0055
int string shared_pref_sender_id 0x7f0b005e
int string shared_pref_username 0x7f0b0059
int string string_content 0x7f0b0020
int string title_activity_agent_settings 0x7f0b0038
int string title_activity_alert 0x7f0b003e
int string title_activity_authentication_error 0x7f0b0035
int string title_activity_available_operations 0x7f0b0039
int string title_activity_display_device_info 0x7f0b0027
int string title_activity_entry 0x7f0b002a
int string title_activity_log 0x7f0b009d
int string title_activity_notification 0x7f0b0036
int string title_activity_notify 0x7f0b0037
int string title_activity_register_successful 0x7f0b0029
int string title_head_authentication_error 0x7f0b002b
int string title_head_confirm_pin 0x7f0b0044
int string title_head_connection_error 0x7f0b002d
int string title_head_init_error 0x7f0b0043
int string title_head_notification_error 0x7f0b002e
int string title_head_registration_error 0x7f0b002c
int string title_init_msg_error 0x7f0b0042
int string toast_error_password 0x7f0b004a
int string toast_error_username 0x7f0b0049
int string toast_message_enter_server_address 0x7f0b0048
int string toast_message_pin_change_failed 0x7f0b0047
int string toast_message_pin_change_success 0x7f0b0046
int string url 0x7f0b0028
int string username 0x7f0b0061
int string validation_pin_confirm 0x7f0b009f
int string yes 0x7f0b0092
int style AppBaseTheme 0x7f0c0059
int style AppTheme 0x7f0c005a
int style ButtonText 0x7f0c005f
int style DialogWindowTitle_Sherlock 0x7f0c0036
int style DialogWindowTitle_Sherlock_Light 0x7f0c0037
int style Sherlock___TextAppearance_Small 0x7f0c004a
int style Sherlock___Theme 0x7f0c004e
int style Sherlock___Theme_DarkActionBar 0x7f0c0050
int style Sherlock___Theme_Dialog 0x7f0c0051
int style Sherlock___Theme_Light 0x7f0c004f
int style Sherlock___Widget_ActionBar 0x7f0c0001
int style Sherlock___Widget_ActionMode 0x7f0c0016
int style Sherlock___Widget_ActivityChooserView 0x7f0c001e
int style Sherlock___Widget_Holo_DropDownItem 0x7f0c0029
int style Sherlock___Widget_Holo_ListView 0x7f0c0026
int style Sherlock___Widget_Holo_Spinner 0x7f0c0023
int style Sherlock___Widget_SearchAutoCompleteTextView 0x7f0c0033
int style TextAppearance_Sherlock_DialogWindowTitle 0x7f0c0048
int style TextAppearance_Sherlock_Light_DialogWindowTitle 0x7f0c0049
int style TextAppearance_Sherlock_Light_Small 0x7f0c004c
int style TextAppearance_Sherlock_Light_Widget_PopupMenu_Large 0x7f0c0043
int style TextAppearance_Sherlock_Light_Widget_PopupMenu_Small 0x7f0c0045
int style TextAppearance_Sherlock_Small 0x7f0c004b
int style TextAppearance_Sherlock_Widget_ActionBar_Menu 0x7f0c0038
int style TextAppearance_Sherlock_Widget_ActionBar_Subtitle 0x7f0c003b
int style TextAppearance_Sherlock_Widget_ActionBar_Subtitle_Inverse 0x7f0c003c
int style TextAppearance_Sherlock_Widget_ActionBar_Title 0x7f0c0039
int style TextAppearance_Sherlock_Widget_ActionBar_Title_Inverse 0x7f0c003a
int style TextAppearance_Sherlock_Widget_ActionMode_Subtitle 0x7f0c003f
int style TextAppearance_Sherlock_Widget_ActionMode_Subtitle_Inverse 0x7f0c0040
int style TextAppearance_Sherlock_Widget_ActionMode_Title 0x7f0c003d
int style TextAppearance_Sherlock_Widget_ActionMode_Title_Inverse 0x7f0c003e
int style TextAppearance_Sherlock_Widget_DropDownHint 0x7f0c004d
int style TextAppearance_Sherlock_Widget_DropDownItem 0x7f0c0047
int style TextAppearance_Sherlock_Widget_PopupMenu 0x7f0c0041
int style TextAppearance_Sherlock_Widget_PopupMenu_Large 0x7f0c0042
int style TextAppearance_Sherlock_Widget_PopupMenu_Small 0x7f0c0044
int style TextAppearance_Sherlock_Widget_TextView_SpinnerItem 0x7f0c0046
int style Theme_Sherlock 0x7f0c0052
int style Theme_Sherlock_Dialog 0x7f0c0057
int style Theme_Sherlock_Light 0x7f0c0053
int style Theme_Sherlock_Light_DarkActionBar 0x7f0c0054
int style Theme_Sherlock_Light_Dialog 0x7f0c0058
int style Theme_Sherlock_Light_NoActionBar 0x7f0c0056
int style Theme_Sherlock_NoActionBar 0x7f0c0055
int style TitleBar 0x7f0c005c
int style TitleBarLogo 0x7f0c005d
int style TitleBarOption 0x7f0c005e
int style TopBarTheme 0x7f0c005b
int style Widget 0x7f0c0000
int style Widget_Sherlock_ActionBar 0x7f0c0002
int style Widget_Sherlock_ActionBar_Solid 0x7f0c0003
int style Widget_Sherlock_ActionBar_TabBar 0x7f0c000a
int style Widget_Sherlock_ActionBar_TabText 0x7f0c000d
int style Widget_Sherlock_ActionBar_TabView 0x7f0c0007
int style Widget_Sherlock_ActionButton 0x7f0c0010
int style Widget_Sherlock_ActionButton_CloseMode 0x7f0c0012
int style Widget_Sherlock_ActionButton_Overflow 0x7f0c0014
int style Widget_Sherlock_ActionMode 0x7f0c0017
int style Widget_Sherlock_ActivityChooserView 0x7f0c001f
int style Widget_Sherlock_Button_Small 0x7f0c0021
int style Widget_Sherlock_DropDownItem_Spinner 0x7f0c002a
int style Widget_Sherlock_Light_ActionBar 0x7f0c0004
int style Widget_Sherlock_Light_ActionBar_Solid 0x7f0c0005
int style Widget_Sherlock_Light_ActionBar_Solid_Inverse 0x7f0c0006
int style Widget_Sherlock_Light_ActionBar_TabBar 0x7f0c000b
int style Widget_Sherlock_Light_ActionBar_TabBar_Inverse 0x7f0c000c
int style Widget_Sherlock_Light_ActionBar_TabText 0x7f0c000e
int style Widget_Sherlock_Light_ActionBar_TabText_Inverse 0x7f0c000f
int style Widget_Sherlock_Light_ActionBar_TabView 0x7f0c0008
int style Widget_Sherlock_Light_ActionBar_TabView_Inverse 0x7f0c0009
int style Widget_Sherlock_Light_ActionButton 0x7f0c0011
int style Widget_Sherlock_Light_ActionButton_CloseMode 0x7f0c0013
int style Widget_Sherlock_Light_ActionButton_Overflow 0x7f0c0015
int style Widget_Sherlock_Light_ActionMode 0x7f0c0018
int style Widget_Sherlock_Light_ActionMode_Inverse 0x7f0c0019
int style Widget_Sherlock_Light_ActivityChooserView 0x7f0c0020
int style Widget_Sherlock_Light_Button_Small 0x7f0c0022
int style Widget_Sherlock_Light_DropDownItem_Spinner 0x7f0c002b
int style Widget_Sherlock_Light_ListPopupWindow 0x7f0c001b
int style Widget_Sherlock_Light_ListView_DropDown 0x7f0c0028
int style Widget_Sherlock_Light_PopupMenu 0x7f0c001d
int style Widget_Sherlock_Light_PopupWindow_ActionMode 0x7f0c002d
int style Widget_Sherlock_Light_ProgressBar 0x7f0c002f
int style Widget_Sherlock_Light_ProgressBar_Horizontal 0x7f0c0031
int style Widget_Sherlock_Light_SearchAutoCompleteTextView 0x7f0c0035
int style Widget_Sherlock_Light_Spinner_DropDown_ActionBar 0x7f0c0025
int style Widget_Sherlock_ListPopupWindow 0x7f0c001a
int style Widget_Sherlock_ListView_DropDown 0x7f0c0027
int style Widget_Sherlock_PopupMenu 0x7f0c001c
int style Widget_Sherlock_PopupWindow_ActionMode 0x7f0c002c
int style Widget_Sherlock_ProgressBar 0x7f0c002e
int style Widget_Sherlock_ProgressBar_Horizontal 0x7f0c0030
int style Widget_Sherlock_SearchAutoCompleteTextView 0x7f0c0034
int style Widget_Sherlock_Spinner_DropDown_ActionBar 0x7f0c0024
int style Widget_Sherlock_TextView_SpinnerItem 0x7f0c0032
int[] styleable SherlockActionBar { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 }
int styleable SherlockActionBar_background 2
int styleable SherlockActionBar_backgroundSplit 3
int styleable SherlockActionBar_backgroundStacked 12
int styleable SherlockActionBar_customNavigationLayout 13
int styleable SherlockActionBar_displayOptions 7
int styleable SherlockActionBar_divider 5
int styleable SherlockActionBar_height 4
int styleable SherlockActionBar_homeLayout 14
int styleable SherlockActionBar_icon 10
int styleable SherlockActionBar_indeterminateProgressStyle 16
int styleable SherlockActionBar_itemPadding 18
int styleable SherlockActionBar_logo 11
int styleable SherlockActionBar_navigationMode 6
int styleable SherlockActionBar_progressBarPadding 17
int styleable SherlockActionBar_progressBarStyle 15
int styleable SherlockActionBar_subtitle 9
int styleable SherlockActionBar_subtitleTextStyle 1
int styleable SherlockActionBar_title 8
int styleable SherlockActionBar_titleTextStyle 0
int[] styleable SherlockActionMenuItemView { 0x0101013f }
int styleable SherlockActionMenuItemView_android_minWidth 0
int[] styleable SherlockActionMode { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004 }
int styleable SherlockActionMode_background 2
int styleable SherlockActionMode_backgroundSplit 3
int styleable SherlockActionMode_height 4
int styleable SherlockActionMode_subtitleTextStyle 1
int styleable SherlockActionMode_titleTextStyle 0
int[] styleable SherlockActivityChooserView { 0x010100d4, 0x7f01005d, 0x7f01005e }
int styleable SherlockActivityChooserView_android_background 0
int styleable SherlockActivityChooserView_expandActivityOverflowButtonDrawable 2
int styleable SherlockActivityChooserView_initialActivityCount 1
int[] styleable SherlockMenuGroup { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }
int styleable SherlockMenuGroup_android_checkableBehavior 5
int styleable SherlockMenuGroup_android_enabled 0
int styleable SherlockMenuGroup_android_id 1
int styleable SherlockMenuGroup_android_menuCategory 3
int styleable SherlockMenuGroup_android_orderInCategory 4
int styleable SherlockMenuGroup_android_visible 2
int[] styleable SherlockMenuItem { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x010102d9, 0x010102fb, 0x010102fc, 0x01010389 }
int styleable SherlockMenuItem_android_actionLayout 14
int styleable SherlockMenuItem_android_actionProviderClass 16
int styleable SherlockMenuItem_android_actionViewClass 15
int styleable SherlockMenuItem_android_alphabeticShortcut 9
int styleable SherlockMenuItem_android_checkable 11
int styleable SherlockMenuItem_android_checked 3
int styleable SherlockMenuItem_android_enabled 1
int styleable SherlockMenuItem_android_icon 0
int styleable SherlockMenuItem_android_id 2
int styleable SherlockMenuItem_android_menuCategory 5
int styleable SherlockMenuItem_android_numericShortcut 10
int styleable SherlockMenuItem_android_onClick 12
int styleable SherlockMenuItem_android_orderInCategory 6
int styleable SherlockMenuItem_android_showAsAction 13
int styleable SherlockMenuItem_android_title 7
int styleable SherlockMenuItem_android_titleCondensed 8
int styleable SherlockMenuItem_android_visible 4
int[] styleable SherlockMenuView { 0x7f010055, 0x7f010056, 0x7f010057, 0x7f010058, 0x7f010059, 0x7f01005a, 0x7f01005b, 0x7f01005c }
int styleable SherlockMenuView_headerBackground 3
int styleable SherlockMenuView_horizontalDivider 1
int styleable SherlockMenuView_itemBackground 4
int styleable SherlockMenuView_itemIconDisabledAlpha 6
int styleable SherlockMenuView_itemTextAppearance 0
int styleable SherlockMenuView_preserveIconSpacing 7
int styleable SherlockMenuView_verticalDivider 2
int styleable SherlockMenuView_windowAnimationStyle 5
int[] styleable SherlockSearchView { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005f, 0x7f010060 }
int styleable SherlockSearchView_android_imeOptions 2
int styleable SherlockSearchView_android_inputType 1
int styleable SherlockSearchView_android_maxWidth 0
int styleable SherlockSearchView_iconifiedByDefault 3
int styleable SherlockSearchView_queryHint 4
int[] styleable SherlockSpinner { 0x010100af, 0x01010175, 0x01010176, 0x0101017b, 0x01010262, 0x010102ac, 0x010102ad, 0x0101043a }
int styleable SherlockSpinner_android_dropDownHorizontalOffset 5
int styleable SherlockSpinner_android_dropDownSelector 1
int styleable SherlockSpinner_android_dropDownVerticalOffset 6
int styleable SherlockSpinner_android_dropDownWidth 4
int styleable SherlockSpinner_android_gravity 0
int styleable SherlockSpinner_android_popupBackground 2
int styleable SherlockSpinner_android_popupPromptView 7
int styleable SherlockSpinner_android_prompt 3
int[] styleable SherlockTheme { 0x01010057, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037, 0x7f010038, 0x7f010039, 0x7f01003a, 0x7f01003b, 0x7f01003c, 0x7f01003d, 0x7f01003e, 0x7f01003f, 0x7f010040, 0x7f010041, 0x7f010042, 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047 }
int styleable SherlockTheme_actionBarDivider 9
int styleable SherlockTheme_actionBarItemBackground 10
int styleable SherlockTheme_actionBarSize 8
int styleable SherlockTheme_actionBarSplitStyle 6
int styleable SherlockTheme_actionBarStyle 5
int styleable SherlockTheme_actionBarTabBarStyle 2
int styleable SherlockTheme_actionBarTabStyle 1
int styleable SherlockTheme_actionBarTabTextStyle 3
int styleable SherlockTheme_actionBarWidgetTheme 7
int styleable SherlockTheme_actionButtonStyle 53
int styleable SherlockTheme_actionDropDownStyle 52
int styleable SherlockTheme_actionMenuTextAppearance 11
int styleable SherlockTheme_actionMenuTextColor 12
int styleable SherlockTheme_actionModeBackground 15
int styleable SherlockTheme_actionModeCloseButtonStyle 14
int styleable SherlockTheme_actionModeCloseDrawable 17
int styleable SherlockTheme_actionModePopupWindowStyle 19
int styleable SherlockTheme_actionModeShareDrawable 18
int styleable SherlockTheme_actionModeSplitBackground 16
int styleable SherlockTheme_actionModeStyle 13
int styleable SherlockTheme_actionOverflowButtonStyle 4
int styleable SherlockTheme_actionSpinnerItemStyle 58
int styleable SherlockTheme_activatedBackgroundIndicator 66
int styleable SherlockTheme_activityChooserViewStyle 65
int styleable SherlockTheme_android_windowIsFloating 0
int styleable SherlockTheme_buttonStyleSmall 20
int styleable SherlockTheme_dividerVertical 51
int styleable SherlockTheme_dropDownListViewStyle 55
int styleable SherlockTheme_dropdownListPreferredItemHeight 57
int styleable SherlockTheme_homeAsUpIndicator 54
int styleable SherlockTheme_listPopupWindowStyle 64
int styleable SherlockTheme_listPreferredItemHeightSmall 45
int styleable SherlockTheme_listPreferredItemPaddingLeft 46
int styleable SherlockTheme_listPreferredItemPaddingRight 47
int styleable SherlockTheme_popupMenuStyle 56
int styleable SherlockTheme_searchAutoCompleteTextView 31
int styleable SherlockTheme_searchDropdownBackground 32
int styleable SherlockTheme_searchResultListItemHeight 42
int styleable SherlockTheme_searchViewCloseIcon 33
int styleable SherlockTheme_searchViewEditQuery 37
int styleable SherlockTheme_searchViewEditQueryBackground 38
int styleable SherlockTheme_searchViewGoIcon 34
int styleable SherlockTheme_searchViewSearchIcon 35
int styleable SherlockTheme_searchViewTextField 39
int styleable SherlockTheme_searchViewTextFieldRight 40
int styleable SherlockTheme_searchViewVoiceIcon 36
int styleable SherlockTheme_selectableItemBackground 21
int styleable SherlockTheme_spinnerDropDownItemStyle 30
int styleable SherlockTheme_spinnerItemStyle 29
int styleable SherlockTheme_textAppearanceLargePopupMenu 23
int styleable SherlockTheme_textAppearanceListItemSmall 48
int styleable SherlockTheme_textAppearanceSearchResultSubtitle 44
int styleable SherlockTheme_textAppearanceSearchResultTitle 43
int styleable SherlockTheme_textAppearanceSmall 25
int styleable SherlockTheme_textAppearanceSmallPopupMenu 24
int styleable SherlockTheme_textColorPrimary 26
int styleable SherlockTheme_textColorPrimaryDisableOnly 27
int styleable SherlockTheme_textColorPrimaryInverse 28
int styleable SherlockTheme_textColorSearchUrl 41
int styleable SherlockTheme_windowActionBar 60
int styleable SherlockTheme_windowActionBarOverlay 61
int styleable SherlockTheme_windowActionModeOverlay 62
int styleable SherlockTheme_windowContentOverlay 22
int styleable SherlockTheme_windowMinWidthMajor 49
int styleable SherlockTheme_windowMinWidthMinor 50
int styleable SherlockTheme_windowNoTitle 59
int styleable SherlockTheme_windowSplitActionBar 63
int[] styleable SherlockView { 0x010100da }
int styleable SherlockView_android_focusable 0
int xml wso2_device_admin 0x7f040000

@ -0,0 +1,5 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
1421928865000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-mdm/product/modules/agents/android/client/libs/android-support-v4.jar
1421928865000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-mdm/product/modules/agents/android/client/plugins/ActionBarSherlock/library/libs/android-support-v4.jar

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100" <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100" android:versionName="4.2.0" package="com.actionbarsherlock">
android:versionName="4.2.0" package="com.actionbarsherlock">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>

@ -9,4 +9,4 @@
android.library=true android.library=true
# Project target. # Project target.
target=android-15 target=android-15

@ -115,8 +115,8 @@ public abstract class ActionBarSherlock {
* Register an ActionBarSherlock implementation. * Register an ActionBarSherlock implementation.
* *
* @param implementationClass Target implementation class which extends * @param implementationClass Target implementation class which extends
* {@link com.actionbarsherlock.ActionBarSherlock}. This class must also be annotated with * {@link ActionBarSherlock}. This class must also be annotated with
* {@link com.actionbarsherlock.ActionBarSherlock.Implementation}. * {@link Implementation}.
*/ */
public static void registerImplementation(Class<? extends ActionBarSherlock> implementationClass) { public static void registerImplementation(Class<? extends ActionBarSherlock> implementationClass) {
if (!implementationClass.isAnnotationPresent(Implementation.class)) { if (!implementationClass.isAnnotationPresent(Implementation.class)) {
@ -332,7 +332,7 @@ public abstract class ActionBarSherlock {
/** /**
* Indicate that the menu should be recreated by calling * Indicate that the menu should be recreated by calling
* {@link com.actionbarsherlock.ActionBarSherlock.OnCreateOptionsMenuListener#onCreateOptionsMenu(com.actionbarsherlock.view.Menu)}. * {@link OnCreateOptionsMenuListener#onCreateOptionsMenu(com.actionbarsherlock.view.Menu)}.
*/ */
public abstract void dispatchInvalidateOptionsMenu(); public abstract void dispatchInvalidateOptionsMenu();

@ -41,14 +41,14 @@ import android.widget.SpinnerAdapter;
* the left, followed by the activity title. If your activity has an options menu, you can make * the left, followed by the activity title. If your activity has an options menu, you can make
* select items accessible directly from the action bar as "action items". You can also * select items accessible directly from the action bar as "action items". You can also
* modify various characteristics of the action bar or remove it completely.</p> * modify various characteristics of the action bar or remove it completely.</p>
* <p>From your activity, you can retrieve an instance of {@link com.actionbarsherlock.app.ActionBar} by calling {@link * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link
* android.app.Activity#getActionBar getActionBar()}.</p> * android.app.Activity#getActionBar getActionBar()}.</p>
* <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions,
* using an {@link android.view.ActionMode}. For example, when the user selects one or more items in * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in
* your activity, you can enable an action mode that offers actions specific to the selected * your activity, you can enable an action mode that offers actions specific to the selected
* items, with a UI that temporarily replaces the action bar. Although the UI may occupy the * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the
* same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for
* {@link com.actionbarsherlock.app.ActionBar}. * {@link ActionBar}.
* <div class="special reference"> * <div class="special reference">
* <h3>Developer Guides</h3> * <h3>Developer Guides</h3>
* <p>For information about how to use the action bar, including how to add action items, navigation * <p>For information about how to use the action bar, including how to add action items, navigation
@ -496,7 +496,7 @@ public abstract class ActionBar {
public abstract int getDisplayOptions(); public abstract int getDisplayOptions();
/** /**
* Create and return a new {@link com.actionbarsherlock.app.ActionBar.Tab}. * Create and return a new {@link Tab}.
* This tab will not be included in the action bar until it is added. * This tab will not be included in the action bar until it is added.
* *
* <p>Very often tabs will be used to switch between {@link Fragment} * <p>Very often tabs will be used to switch between {@link Fragment}
@ -507,7 +507,7 @@ public abstract class ActionBar {
* *
* @return A new Tab * @return A new Tab
* *
* @see #addTab(com.actionbarsherlock.app.ActionBar.Tab) * @see #addTab(Tab)
*/ */
public abstract Tab newTab(); public abstract Tab newTab();
@ -807,7 +807,7 @@ public abstract class ActionBar {
public abstract Object getTag(); public abstract Object getTag();
/** /**
* Set the {@link com.actionbarsherlock.app.ActionBar.TabListener} that will handle switching to and from this tab. * Set the {@link TabListener} that will handle switching to and from this tab.
* All tabs must have a TabListener set before being added to the ActionBar. * All tabs must have a TabListener set before being added to the ActionBar.
* *
* @param listener Listener to handle tab selection events * @param listener Listener to handle tab selection events

@ -36,7 +36,7 @@ public abstract class Animator implements Cloneable {
* Starts this animation. If the animation has a nonzero startDelay, the animation will start * Starts this animation. If the animation has a nonzero startDelay, the animation will start
* running after that delay elapses. A non-delayed animation will have its initial * running after that delay elapses. A non-delayed animation will have its initial
* value(s) set immediately, followed by calls to * value(s) set immediately, followed by calls to
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.Animator.AnimatorListener#onAnimationStart(com.actionbarsherlock.internal.nineoldandroids.animation.Animator)} for any listeners of this animator. * {@link AnimatorListener#onAnimationStart(Animator)} for any listeners of this animator.
* *
* <p>The animation started by calling this method will be run on the thread that called * <p>The animation started by calling this method will be run on the thread that called
* this method. This thread should have a Looper on it (a runtime exception will be thrown if * this method. This thread should have a Looper on it (a runtime exception will be thrown if
@ -51,9 +51,9 @@ public abstract class Animator implements Cloneable {
/** /**
* Cancels the animation. Unlike {@link #end()}, <code>cancel()</code> causes the animation to * Cancels the animation. Unlike {@link #end()}, <code>cancel()</code> causes the animation to
* stop in its tracks, sending an * stop in its tracks, sending an
* {@link android.animation.Animator.AnimatorListener#onAnimationCancel(com.actionbarsherlock.internal.nineoldandroids.animation.Animator)} to * {@link android.animation.Animator.AnimatorListener#onAnimationCancel(Animator)} to
* its listeners, followed by an * its listeners, followed by an
* {@link android.animation.Animator.AnimatorListener#onAnimationEnd(com.actionbarsherlock.internal.nineoldandroids.animation.Animator)} message. * {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} message.
* *
* <p>This method must be called on the thread that is running the animation.</p> * <p>This method must be called on the thread that is running the animation.</p>
*/ */
@ -63,7 +63,7 @@ public abstract class Animator implements Cloneable {
/** /**
* Ends the animation. This causes the animation to assign the end value of the property being * Ends the animation. This causes the animation to assign the end value of the property being
* animated, then calling the * animated, then calling the
* {@link android.animation.Animator.AnimatorListener#onAnimationEnd(com.actionbarsherlock.internal.nineoldandroids.animation.Animator)} method on * {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} method on
* its listeners. * its listeners.
* *
* <p>This method must be called on the thread that is running the animation.</p> * <p>This method must be called on the thread that is running the animation.</p>

@ -28,10 +28,10 @@ import android.view.animation.Interpolator;
* can be set up to play together, in sequence, or after a specified delay. * can be set up to play together, in sequence, or after a specified delay.
* *
* <p>There are two different approaches to adding animations to a <code>AnimatorSet</code>: * <p>There are two different approaches to adding animations to a <code>AnimatorSet</code>:
* either the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playTogether(Animator[]) playTogether()} or * either the {@link AnimatorSet#playTogether(Animator[]) playTogether()} or
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playSequentially(Animator[]) playSequentially()} methods can be called to add * {@link AnimatorSet#playSequentially(Animator[]) playSequentially()} methods can be called to add
* a set of animations all at once, or the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} can be * a set of animations all at once, or the {@link AnimatorSet#play(Animator)} can be
* used in conjunction with methods in the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet.Builder Builder} * used in conjunction with methods in the {@link AnimatorSet.Builder Builder}
* class to add animations * class to add animations
* one by one.</p> * one by one.</p>
* *
@ -959,14 +959,14 @@ public final class AnimatorSet extends Animator {
* The <code>Builder</code> object is a utility class to facilitate adding animations to a * The <code>Builder</code> object is a utility class to facilitate adding animations to a
* <code>AnimatorSet</code> along with the relationships between the various animations. The * <code>AnimatorSet</code> along with the relationships between the various animations. The
* intention of the <code>Builder</code> methods, along with the {@link * intention of the <code>Builder</code> methods, along with the {@link
* com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator) play()} method of <code>AnimatorSet</code> is to make it possible * AnimatorSet#play(Animator) play()} method of <code>AnimatorSet</code> is to make it possible
* to express the dependency relationships of animations in a natural way. Developers can also * to express the dependency relationships of animations in a natural way. Developers can also
* use the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playTogether(Animator[]) playTogether()} and {@link * use the {@link AnimatorSet#playTogether(Animator[]) playTogether()} and {@link
* com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playSequentially(Animator[]) playSequentially()} methods if these suit the need, * AnimatorSet#playSequentially(Animator[]) playSequentially()} methods if these suit the need,
* but it might be easier in some situations to express the AnimatorSet of animations in pairs. * but it might be easier in some situations to express the AnimatorSet of animations in pairs.
* <p/> * <p/>
* <p>The <code>Builder</code> object cannot be constructed directly, but is rather constructed * <p>The <code>Builder</code> object cannot be constructed directly, but is rather constructed
* internally via a call to {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)}.</p> * internally via a call to {@link AnimatorSet#play(Animator)}.</p>
* <p/> * <p/>
* <p>For example, this sets up a AnimatorSet to play anim1 and anim2 at the same time, anim3 to * <p>For example, this sets up a AnimatorSet to play anim1 and anim2 at the same time, anim3 to
* play when anim2 finishes, and anim4 to play when anim3 finishes:</p> * play when anim2 finishes, and anim4 to play when anim3 finishes:</p>
@ -977,14 +977,14 @@ public final class AnimatorSet extends Animator {
* s.play(anim4).after(anim3); * s.play(anim4).after(anim3);
* </pre> * </pre>
* <p/> * <p/>
* <p>Note in the example that both {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet.Builder#before(Animator)} and {@link * <p>Note in the example that both {@link Builder#before(Animator)} and {@link
* com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet.Builder#after(Animator)} are used. These are just different ways of expressing the same * Builder#after(Animator)} are used. These are just different ways of expressing the same
* relationship and are provided to make it easier to say things in a way that is more natural, * relationship and are provided to make it easier to say things in a way that is more natural,
* depending on the situation.</p> * depending on the situation.</p>
* <p/> * <p/>
* <p>It is possible to make several calls into the same <code>Builder</code> object to express * <p>It is possible to make several calls into the same <code>Builder</code> object to express
* multiple relationships. However, note that it is only the animation passed into the initial * multiple relationships. However, note that it is only the animation passed into the initial
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} method that is the dependency in any of the successive * {@link AnimatorSet#play(Animator)} method that is the dependency in any of the successive
* calls to the <code>Builder</code> object. For example, the following code starts both anim2 * calls to the <code>Builder</code> object. For example, the following code starts both anim2
* and anim3 when anim1 ends; there is no direct dependency relationship between anim2 and * and anim3 when anim1 ends; there is no direct dependency relationship between anim2 and
* anim3: * anim3:
@ -1033,10 +1033,10 @@ public final class AnimatorSet extends Animator {
/** /**
* Sets up the given animation to play at the same time as the animation supplied in the * Sets up the given animation to play at the same time as the animation supplied in the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} call that created this <code>Builder</code> object. * {@link AnimatorSet#play(Animator)} call that created this <code>Builder</code> object.
* *
* @param anim The animation that will play when the animation supplied to the * @param anim The animation that will play when the animation supplied to the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} method starts. * {@link AnimatorSet#play(Animator)} method starts.
*/ */
public Builder with(Animator anim) { public Builder with(Animator anim) {
Node node = mNodeMap.get(anim); Node node = mNodeMap.get(anim);
@ -1052,11 +1052,11 @@ public final class AnimatorSet extends Animator {
/** /**
* Sets up the given animation to play when the animation supplied in the * Sets up the given animation to play when the animation supplied in the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} call that created this <code>Builder</code> object * {@link AnimatorSet#play(Animator)} call that created this <code>Builder</code> object
* ends. * ends.
* *
* @param anim The animation that will play when the animation supplied to the * @param anim The animation that will play when the animation supplied to the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} method ends. * {@link AnimatorSet#play(Animator)} method ends.
*/ */
public Builder before(Animator anim) { public Builder before(Animator anim) {
Node node = mNodeMap.get(anim); Node node = mNodeMap.get(anim);
@ -1072,11 +1072,11 @@ public final class AnimatorSet extends Animator {
/** /**
* Sets up the given animation to play when the animation supplied in the * Sets up the given animation to play when the animation supplied in the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} call that created this <code>Builder</code> object * {@link AnimatorSet#play(Animator)} call that created this <code>Builder</code> object
* to start when the animation supplied in this method call ends. * to start when the animation supplied in this method call ends.
* *
* @param anim The animation whose end will cause the animation supplied to the * @param anim The animation whose end will cause the animation supplied to the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} method to play. * {@link AnimatorSet#play(Animator)} method to play.
*/ */
public Builder after(Animator anim) { public Builder after(Animator anim) {
Node node = mNodeMap.get(anim); Node node = mNodeMap.get(anim);
@ -1092,7 +1092,7 @@ public final class AnimatorSet extends Animator {
/** /**
* Sets up the animation supplied in the * Sets up the animation supplied in the
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} call that created this <code>Builder</code> object * {@link AnimatorSet#play(Animator)} call that created this <code>Builder</code> object
* to play when the given amount of time elapses. * to play when the given amount of time elapses.
* *
* @param delay The number of milliseconds that should elapse before the * @param delay The number of milliseconds that should elapse before the

@ -17,12 +17,12 @@
package com.actionbarsherlock.internal.nineoldandroids.animation; package com.actionbarsherlock.internal.nineoldandroids.animation;
/** /**
* Interface for use with the {@link ValueAnimator#setEvaluator(com.actionbarsherlock.internal.nineoldandroids.animation.TypeEvaluator)} function. Evaluators * Interface for use with the {@link ValueAnimator#setEvaluator(TypeEvaluator)} function. Evaluators
* allow developers to create animations on arbitrary property types, by allowing them to supply * allow developers to create animations on arbitrary property types, by allowing them to supply
* custom evaulators for types that are not automatically understood and used by the animation * custom evaulators for types that are not automatically understood and used by the animation
* system. * system.
* *
* @see ValueAnimator#setEvaluator(com.actionbarsherlock.internal.nineoldandroids.animation.TypeEvaluator) * @see ValueAnimator#setEvaluator(TypeEvaluator)
*/ */
public interface TypeEvaluator<T> { public interface TypeEvaluator<T> {

@ -38,7 +38,7 @@ import java.util.HashMap;
* <p>By default, ValueAnimator uses non-linear time interpolation, via the * <p>By default, ValueAnimator uses non-linear time interpolation, via the
* {@link AccelerateDecelerateInterpolator} class, which accelerates into and decelerates * {@link AccelerateDecelerateInterpolator} class, which accelerates into and decelerates
* out of an animation. This behavior can be changed by calling * out of an animation. This behavior can be changed by calling
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator#setInterpolator(TimeInterpolator)}.</p> * {@link ValueAnimator#setInterpolator(TimeInterpolator)}.</p>
*/ */
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
public class ValueAnimator extends Animator { public class ValueAnimator extends Animator {
@ -733,7 +733,7 @@ public class ValueAnimator extends Animator {
* The most recent value calculated by this <code>ValueAnimator</code> when there is just one * The most recent value calculated by this <code>ValueAnimator</code> when there is just one
* property being animated. This value is only sensible while the animation is running. The main * property being animated. This value is only sensible while the animation is running. The main
* purpose for this read-only property is to retrieve the value from the <code>ValueAnimator</code> * purpose for this read-only property is to retrieve the value from the <code>ValueAnimator</code>
* during a call to {@link com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener#onAnimationUpdate(com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator)}, which * during a call to {@link AnimatorUpdateListener#onAnimationUpdate(ValueAnimator)}, which
* is called during each animation frame, immediately after the value is calculated. * is called during each animation frame, immediately after the value is calculated.
* *
* @return animatedValue The value most recently calculated by this <code>ValueAnimator</code> for * @return animatedValue The value most recently calculated by this <code>ValueAnimator</code> for
@ -753,7 +753,7 @@ public class ValueAnimator extends Animator {
* The most recent value calculated by this <code>ValueAnimator</code> for <code>propertyName</code>. * The most recent value calculated by this <code>ValueAnimator</code> for <code>propertyName</code>.
* The main purpose for this read-only property is to retrieve the value from the * The main purpose for this read-only property is to retrieve the value from the
* <code>ValueAnimator</code> during a call to * <code>ValueAnimator</code> during a call to
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener#onAnimationUpdate(com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator)}, which * {@link AnimatorUpdateListener#onAnimationUpdate(ValueAnimator)}, which
* is called during each animation frame, immediately after the value is calculated. * is called during each animation frame, immediately after the value is calculated.
* *
* @return animatedValue The value most recently calculated for the named property * @return animatedValue The value most recently calculated for the named property

@ -51,7 +51,7 @@ public interface MenuPresenter {
/** /**
* Initialize this presenter for the given context and menu. * Initialize this presenter for the given context and menu.
* This method is called by MenuBuilder when a presenter is * This method is called by MenuBuilder when a presenter is
* added. See {@link MenuBuilder#addMenuPresenter(com.actionbarsherlock.internal.view.menu.MenuPresenter)} * added. See {@link MenuBuilder#addMenuPresenter(MenuPresenter)}
* *
* @param context Context for this presenter; used for view creation and resource management * @param context Context for this presenter; used for view creation and resource management
* @param menu Menu to host * @param menu Menu to host

@ -261,7 +261,7 @@ public abstract class IcsAbsSpinner extends IcsAdapterView<SpinnerAdapter> {
void recycleAllViews() { void recycleAllViews() {
final int childCount = getChildCount(); final int childCount = getChildCount();
final RecycleBin recycleBin = mRecycler; final IcsAbsSpinner.RecycleBin recycleBin = mRecycler;
final int position = mFirstPosition; final int position = mFirstPosition;
// All views go in recycler // All views go in recycler

@ -1080,7 +1080,7 @@ public class IcsProgressBar extends View {
int secondaryProgress; int secondaryProgress;
/** /**
* Constructor called from {@link com.actionbarsherlock.internal.widget.IcsProgressBar#onSaveInstanceState()} * Constructor called from {@link IcsProgressBar#onSaveInstanceState()}
*/ */
SavedState(Parcelable superState) { SavedState(Parcelable superState) {
super(superState); super(superState);

@ -112,16 +112,16 @@ public abstract class ActionMode {
/** /**
* Invalidate the action mode and refresh menu content. The mode's * Invalidate the action mode and refresh menu content. The mode's
* {@link com.actionbarsherlock.view.ActionMode.Callback} will have its * {@link ActionMode.Callback} will have its
* {@link com.actionbarsherlock.view.ActionMode.Callback#onPrepareActionMode(com.actionbarsherlock.view.ActionMode, Menu)} method called. * {@link Callback#onPrepareActionMode(ActionMode, Menu)} method called.
* If it returns true the menu will be scanned for updated content and any relevant changes * If it returns true the menu will be scanned for updated content and any relevant changes
* will be reflected to the user. * will be reflected to the user.
*/ */
public abstract void invalidate(); public abstract void invalidate();
/** /**
* Finish and close this action mode. The action mode's {@link com.actionbarsherlock.view.ActionMode.Callback} will * Finish and close this action mode. The action mode's {@link ActionMode.Callback} will
* have its {@link com.actionbarsherlock.view.ActionMode.Callback#onDestroyActionMode(com.actionbarsherlock.view.ActionMode)} method called. * have its {@link Callback#onDestroyActionMode(ActionMode)} method called.
*/ */
public abstract void finish(); public abstract void finish();
@ -168,18 +168,18 @@ public abstract class ActionMode {
/** /**
* Callback interface for action modes. Supplied to * Callback interface for action modes. Supplied to
* {@link View#startActionMode(com.actionbarsherlock.view.ActionMode.Callback)}, a Callback * {@link View#startActionMode(Callback)}, a Callback
* configures and handles events raised by a user's interaction with an action mode. * configures and handles events raised by a user's interaction with an action mode.
* *
* <p>An action mode's lifecycle is as follows: * <p>An action mode's lifecycle is as follows:
* <ul> * <ul>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onCreateActionMode(com.actionbarsherlock.view.ActionMode, Menu)} once on initial * <li>{@link Callback#onCreateActionMode(ActionMode, Menu)} once on initial
* creation</li> * creation</li>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onPrepareActionMode(com.actionbarsherlock.view.ActionMode, Menu)} after creation * <li>{@link Callback#onPrepareActionMode(ActionMode, Menu)} after creation
* and any time the {@link com.actionbarsherlock.view.ActionMode} is invalidated</li> * and any time the {@link ActionMode} is invalidated</li>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onActionItemClicked(com.actionbarsherlock.view.ActionMode, MenuItem)} any time a * <li>{@link Callback#onActionItemClicked(ActionMode, MenuItem)} any time a
* contextual action button is clicked</li> * contextual action button is clicked</li>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onDestroyActionMode(com.actionbarsherlock.view.ActionMode)} when the action mode * <li>{@link Callback#onDestroyActionMode(ActionMode)} when the action mode
* is closed</li> * is closed</li>
* </ul> * </ul>
*/ */

@ -38,7 +38,7 @@ import android.view.View;
* <ul> * <ul>
* <li> * <li>
* Setting the action provider on a {@link MenuItem} directly by calling * Setting the action provider on a {@link MenuItem} directly by calling
* {@link MenuItem#setActionProvider(com.actionbarsherlock.view.ActionProvider)}. * {@link MenuItem#setActionProvider(ActionProvider)}.
* </li> * </li>
* <li> * <li>
* Declaring the action provider in the menu XML resource. For example: * Declaring the action provider in the menu XML resource. For example:
@ -55,7 +55,7 @@ import android.view.View;
* </ul> * </ul>
* </p> * </p>
* *
* @see MenuItem#setActionProvider(com.actionbarsherlock.view.ActionProvider) * @see MenuItem#setActionProvider(ActionProvider)
* @see MenuItem#getActionProvider() * @see MenuItem#getActionProvider()
*/ */
public abstract class ActionProvider { public abstract class ActionProvider {

@ -26,7 +26,7 @@ import android.view.KeyEvent;
* By default, every Activity supports an options menu of actions or options. * By default, every Activity supports an options menu of actions or options.
* You can add items to this menu and handle clicks on your additions. The * You can add items to this menu and handle clicks on your additions. The
* easiest way of adding menu items is inflating an XML file into the * easiest way of adding menu items is inflating an XML file into the
* {@link com.actionbarsherlock.view.Menu} via {@link MenuInflater}. The easiest way of attaching code to * {@link Menu} via {@link MenuInflater}. The easiest way of attaching code to
* clicks is via {@link Activity#onOptionsItemSelected(MenuItem)} and * clicks is via {@link Activity#onOptionsItemSelected(MenuItem)} and
* {@link Activity#onContextItemSelected(MenuItem)}. * {@link Activity#onContextItemSelected(MenuItem)}.
* <p> * <p>

@ -68,8 +68,8 @@ public interface MenuItem {
* Interface definition for a callback to be invoked when a menu item is * Interface definition for a callback to be invoked when a menu item is
* clicked. * clicked.
* *
* @see Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem) * @see Activity#onContextItemSelected(MenuItem)
* @see Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem) * @see Activity#onOptionsItemSelected(MenuItem)
*/ */
public interface OnMenuItemClickListener { public interface OnMenuItemClickListener {
/** /**
@ -87,16 +87,16 @@ public interface MenuItem {
/** /**
* Interface definition for a callback to be invoked when a menu item * Interface definition for a callback to be invoked when a menu item
* marked with {@link com.actionbarsherlock.view.MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW} is * marked with {@link MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW} is
* expanded or collapsed. * expanded or collapsed.
* *
* @see com.actionbarsherlock.view.MenuItem#expandActionView() * @see MenuItem#expandActionView()
* @see com.actionbarsherlock.view.MenuItem#collapseActionView() * @see MenuItem#collapseActionView()
* @see com.actionbarsherlock.view.MenuItem#setShowAsActionFlags(int) * @see MenuItem#setShowAsActionFlags(int)
*/ */
public interface OnActionExpandListener { public interface OnActionExpandListener {
/** /**
* Called when a menu item with {@link com.actionbarsherlock.view.MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW} * Called when a menu item with {@link MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}
* is expanded. * is expanded.
* @param item Item that was expanded * @param item Item that was expanded
* @return true if the item should expand, false if expansion should be suppressed. * @return true if the item should expand, false if expansion should be suppressed.
@ -104,7 +104,7 @@ public interface MenuItem {
public boolean onMenuItemActionExpand(MenuItem item); public boolean onMenuItemActionExpand(MenuItem item);
/** /**
* Called when a menu item with {@link com.actionbarsherlock.view.MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW} * Called when a menu item with {@link MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}
* is collapsed. * is collapsed.
* @param item Item that was collapsed * @param item Item that was collapsed
* @return true if the item should collapse, false if collapsing should be suppressed. * @return true if the item should collapse, false if collapsing should be suppressed.
@ -421,15 +421,15 @@ public interface MenuItem {
/** /**
* Set a custom listener for invocation of this menu item. In most * Set a custom listener for invocation of this menu item. In most
* situations, it is more efficient and easier to use * situations, it is more efficient and easier to use
* {@link Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem)} or * {@link Activity#onOptionsItemSelected(MenuItem)} or
* {@link Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem)}. * {@link Activity#onContextItemSelected(MenuItem)}.
* *
* @param menuItemClickListener The object to receive invokations. * @param menuItemClickListener The object to receive invokations.
* @return This Item so additional setters can be called. * @return This Item so additional setters can be called.
* @see Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem) * @see Activity#onOptionsItemSelected(MenuItem)
* @see Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem) * @see Activity#onContextItemSelected(MenuItem)
*/ */
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener); public MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener menuItemClickListener);
/** /**
* Gets the extra information linked to this menu item. This extra * Gets the extra information linked to this menu item. This extra
@ -552,8 +552,8 @@ public interface MenuItem {
* Expand the action view associated with this menu item. * Expand the action view associated with this menu item.
* The menu item must have an action view set, as well as * The menu item must have an action view set, as well as
* the showAsAction flag {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. * the showAsAction flag {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}.
* If a listener has been set using {@link #setOnActionExpandListener(com.actionbarsherlock.view.MenuItem.OnActionExpandListener)} * If a listener has been set using {@link #setOnActionExpandListener(OnActionExpandListener)}
* it will have its {@link com.actionbarsherlock.view.MenuItem.OnActionExpandListener#onMenuItemActionExpand(com.actionbarsherlock.view.MenuItem)} * it will have its {@link OnActionExpandListener#onMenuItemActionExpand(MenuItem)}
* method invoked. The listener may return false from this method to prevent expanding * method invoked. The listener may return false from this method to prevent expanding
* the action view. * the action view.
* *
@ -565,8 +565,8 @@ public interface MenuItem {
* Collapse the action view associated with this menu item. * Collapse the action view associated with this menu item.
* The menu item must have an action view set, as well as the showAsAction flag * The menu item must have an action view set, as well as the showAsAction flag
* {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. If a listener has been set using * {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. If a listener has been set using
* {@link #setOnActionExpandListener(com.actionbarsherlock.view.MenuItem.OnActionExpandListener)} it will have its * {@link #setOnActionExpandListener(OnActionExpandListener)} it will have its
* {@link com.actionbarsherlock.view.MenuItem.OnActionExpandListener#onMenuItemActionCollapse(com.actionbarsherlock.view.MenuItem)} method invoked. * {@link OnActionExpandListener#onMenuItemActionCollapse(MenuItem)} method invoked.
* The listener may return false from this method to prevent collapsing the action view. * The listener may return false from this method to prevent collapsing the action view.
* *
* @return true if the action view was collapsed, false otherwise. * @return true if the action view was collapsed, false otherwise.
@ -581,12 +581,12 @@ public interface MenuItem {
* @see #expandActionView() * @see #expandActionView()
* @see #collapseActionView() * @see #collapseActionView()
* @see #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW * @see #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
* @see com.actionbarsherlock.view.MenuItem.OnActionExpandListener * @see OnActionExpandListener
*/ */
public boolean isActionViewExpanded(); public boolean isActionViewExpanded();
/** /**
* Set an {@link com.actionbarsherlock.view.MenuItem.OnActionExpandListener} on this menu item to be notified when * Set an {@link OnActionExpandListener} on this menu item to be notified when
* the associated action view is expanded or collapsed. The menu item must * the associated action view is expanded or collapsed. The menu item must
* be configured to expand or collapse its action view using the flag * be configured to expand or collapse its action view using the flag
* {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}. * {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}.

@ -95,12 +95,12 @@ import java.util.concurrent.Executors;
class ActivityChooserModel extends DataSetObservable { class ActivityChooserModel extends DataSetObservable {
/** /**
* Client that utilizes an {@link com.actionbarsherlock.widget.ActivityChooserModel}. * Client that utilizes an {@link ActivityChooserModel}.
*/ */
public interface ActivityChooserModelClient { public interface ActivityChooserModelClient {
/** /**
* Sets the {@link com.actionbarsherlock.widget.ActivityChooserModel}. * Sets the {@link ActivityChooserModel}.
* *
* @param dataModel The model. * @param dataModel The model.
*/ */
@ -124,7 +124,7 @@ class ActivityChooserModel extends DataSetObservable {
// This cannot be done by a simple comparator since an Activity weight // This cannot be done by a simple comparator since an Activity weight
// is computed from history. Note that Activity implements Comparable. // is computed from history. Note that Activity implements Comparable.
public void sort(Intent intent, List<ActivityResolveInfo> activities, public void sort(Intent intent, List<ActivityResolveInfo> activities,
List<HistoricalRecord> historicalRecords); List<HistoricalRecord> historicalRecords);
} }
/** /**
@ -135,7 +135,7 @@ class ActivityChooserModel extends DataSetObservable {
/** /**
* Called when an activity has been chosen. The client can decide whether * Called when an activity has been chosen. The client can decide whether
* an activity can be chosen and if so the caller of * an activity can be chosen and if so the caller of
* {@link com.actionbarsherlock.widget.ActivityChooserModel#chooseActivity(int)} will receive and {@link Intent} * {@link ActivityChooserModel#chooseActivity(int)} will receive and {@link Intent}
* for launching it. * for launching it.
* <p> * <p>
* <strong>Note:</strong> Modifying the intent is not permitted and * <strong>Note:</strong> Modifying the intent is not permitted and
@ -146,7 +146,7 @@ class ActivityChooserModel extends DataSetObservable {
* @param intent The intent for launching the chosen activity. * @param intent The intent for launching the chosen activity.
* @return Whether the intent is handled and should not be delivered to clients. * @return Whether the intent is handled and should not be delivered to clients.
* *
* @see com.actionbarsherlock.widget.ActivityChooserModel#chooseActivity(int) * @see ActivityChooserModel#chooseActivity(int)
*/ */
public boolean onChooseActivity(ActivityChooserModel host, Intent intent); public boolean onChooseActivity(ActivityChooserModel host, Intent intent);
} }
@ -407,7 +407,7 @@ class ActivityChooserModel extends DataSetObservable {
* *
* @return The activity. * @return The activity.
* *
* @see com.actionbarsherlock.widget.ActivityChooserModel.ActivityResolveInfo * @see ActivityResolveInfo
* @see #setIntent(Intent) * @see #setIntent(Intent)
*/ */
public ResolveInfo getActivity(int index) { public ResolveInfo getActivity(int index) {
@ -449,8 +449,8 @@ class ActivityChooserModel extends DataSetObservable {
* @return An {@link Intent} for launching the activity or null if the * @return An {@link Intent} for launching the activity or null if the
* policy has consumed the intent. * policy has consumed the intent.
* *
* @see com.actionbarsherlock.widget.ActivityChooserModel.HistoricalRecord * @see HistoricalRecord
* @see com.actionbarsherlock.widget.ActivityChooserModel.OnChooseActivityListener * @see OnChooseActivityListener
*/ */
public Intent chooseActivity(int index) { public Intent chooseActivity(int index) {
ActivityResolveInfo chosenActivity = mActivites.get(index); ActivityResolveInfo chosenActivity = mActivites.get(index);
@ -593,7 +593,7 @@ class ActivityChooserModel extends DataSetObservable {
* *
* @param activitySorter The sorter. * @param activitySorter The sorter.
* *
* @see com.actionbarsherlock.widget.ActivityChooserModel.ActivitySorter * @see ActivitySorter
*/ */
public void setActivitySorter(ActivitySorter activitySorter) { public void setActivitySorter(ActivitySorter activitySorter) {
synchronized (mInstanceLock) { synchronized (mInstanceLock) {
@ -609,7 +609,7 @@ class ActivityChooserModel extends DataSetObservable {
* Sorts the activities based on history and an intent. If * Sorts the activities based on history and an intent. If
* a sorter is not specified this a default implementation is used. * a sorter is not specified this a default implementation is used.
* *
* @see #setActivitySorter(com.actionbarsherlock.widget.ActivityChooserModel.ActivitySorter) * @see #setActivitySorter(ActivitySorter)
*/ */
private void sortActivities() { private void sortActivities() {
synchronized (mInstanceLock) { synchronized (mInstanceLock) {

@ -301,7 +301,7 @@ public class ShareActionProvider extends ActionProvider {
} }
/** /**
* Policy that delegates to the {@link com.actionbarsherlock.widget.ShareActionProvider.OnShareTargetSelectedListener}, if such. * Policy that delegates to the {@link OnShareTargetSelectedListener}, if such.
*/ */
private class ShareAcitivityChooserModelPolicy implements OnChooseActivityListener { private class ShareAcitivityChooserModelPolicy implements OnChooseActivityListener {
@Override @Override

@ -1,212 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
~ Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. <modelVersion>4.0.0</modelVersion>
~
~ Licensed under the Apache License, Version 2.0 (the "License"); <parent>
~ you may not use this file except in compliance with the License. <groupId>org.sonatype.oss</groupId>
~ You may obtain a copy of the License at <artifactId>oss-parent</artifactId>
~ <version>7</version>
~ http://www.apache.org/licenses/LICENSE-2.0 </parent>
~
~ Unless required by applicable law or agreed to in writing, software <groupId>com.actionbarsherlock</groupId>
~ distributed under the License is distributed on an "AS IS" BASIS, <artifactId>parent</artifactId>
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <packaging>pom</packaging>
~ See the License for the specific language governing permissions and <version>4.2.0</version>
~ limitations under the License.
--> <name>ActionBarSherlock (Parent)</name>
<description>Android library for implementing the action bar design pattern using the backported sources of Ice Cream Sandwich.</description>
<project xmlns="http://maven.apache.org/POM/4.0.0" <url>http://actionbarsherlock.com</url>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <inceptionYear>2011</inceptionYear>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modules>
<module>library</module>
<parent> <module>samples</module>
<groupId>org.sonatype.oss</groupId> </modules>
<artifactId>oss-parent</artifactId>
<version>7</version> <scm>
</parent> <url>https://github.com/JakeWharton/ActionBarSherlock/</url>
<connection>scm:git:git://github.com/JakeWharton/ActionBarSherlock.git</connection>
<groupId>com.actionbarsherlock</groupId> <developerConnection>scm:git:git@github.com:JakeWharton/ActionBarSherlock.git</developerConnection>
<artifactId>parent</artifactId> </scm>
<packaging>pom</packaging>
<version>4.2.0</version> <developers>
<developer>
<name>ActionBarSherlock (Parent)</name> <name>Jake Wharton</name>
<description>Android library for implementing the action bar design pattern using the backported <email>jakewharton@gmail.com</email>
sources of Ice Cream Sandwich. <id>jakewharton</id>
</description> <url>http://jakewharton.com</url>
<url>http://actionbarsherlock.com</url> <timezone>-5</timezone>
<inceptionYear>2011</inceptionYear> <roles>
<role>developer</role>
<modules> </roles>
<module>library</module> </developer>
<module>samples</module> </developers>
</modules>
<licenses>
<scm> <license>
<url>https://github.com/JakeWharton/ActionBarSherlock/</url> <name>Apache License Version 2.0</name>
<connection>scm:git:git://github.com/JakeWharton/ActionBarSherlock.git</connection> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<developerConnection>scm:git:git@github.com:JakeWharton/ActionBarSherlock.git <distribution>repo</distribution>
</developerConnection> </license>
</scm> </licenses>
<developers> <organization>
<developer> <name>Jake Wharton</name>
<name>Jake Wharton</name> <url>http://jakewharton.com</url>
<email>jakewharton@gmail.com</email> </organization>
<id>jakewharton</id>
<url>http://jakewharton.com</url> <issueManagement>
<timezone>-5</timezone> <system>GitHub Issues</system>
<roles> <url>https://github.com/JakeWharton/ActionBarSherlock/issues</url>
<role>developer</role> </issueManagement>
</roles>
</developer> <properties>
</developers> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<licenses>
<license> <java.version>1.6</java.version>
<name>Apache License Version 2.0</name> <android.version>4.0.1.2</android.version>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <android.platform>14</android.platform>
<distribution>repo</distribution> <android-support.version>r99</android-support.version>
</license>
</licenses> <android-maven.version>3.3.2</android-maven.version>
<junit.version>4.10</junit.version>
<organization>
<name>Jake Wharton</name> <github.downloads.repositoryOwner>JakeWharton</github.downloads.repositoryOwner>
<url>http://jakewharton.com</url> <github.downloads.repositoryName>ActionBarSherlock</github.downloads.repositoryName>
</organization> </properties>
<issueManagement> <dependencyManagement>
<system>GitHub Issues</system> <dependencies>
<url>https://github.com/JakeWharton/ActionBarSherlock/issues</url> <dependency>
</issueManagement> <groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<properties> <version>${android.version}</version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </dependency>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <dependency>
<groupId>com.google.android</groupId>
<java.version>1.6</java.version> <artifactId>support-v4</artifactId>
<android.version>4.0.1.2</android.version> <version>${android-support.version}</version>
<android.platform>14</android.platform>
<android-support.version>r99</android-support.version>
<android-maven.version>3.3.2</android-maven.version>
<junit.version>4.10</junit.version>
<github.downloads.repositoryOwner>JakeWharton</github.downloads.repositoryOwner>
<github.downloads.repositoryName>ActionBarSherlock</github.downloads.repositoryName>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>${android-support.version}</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/android-support-v4.jar</systemPath> <systemPath>${basedir}/libs/android-support-v4.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.nineoldandroids</groupId> <groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId> <artifactId>library</artifactId>
<version>2.4.0</version> <version>2.4.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.rtyley</groupId> <groupId>com.github.rtyley</groupId>
<artifactId>roboguice-sherlock</artifactId> <artifactId>roboguice-sherlock</artifactId>
<version>1.4</version> <version>1.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>${junit.version}</version> <version>${junit.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version> <version>2.5</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId> <groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId> <artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<configuration> <configuration>
<sdk> <sdk>
<platform>${android.platform}</platform> <platform>${android.platform}</platform>
</sdk> </sdk>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version> <version>2.8</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version> <version>2.9.1</version>
<configuration> <configuration>
<failsOnError>true</failsOnError> <failsOnError>true</failsOnError>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>3.0</version> <version>3.0</version>
<configuration> <configuration>
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version> <version>2.2.2</version>
<configuration> <configuration>
<autoVersionSubmodules>true</autoVersionSubmodules> <autoVersionSubmodules>true</autoVersionSubmodules>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.github.github</groupId> <groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId> <artifactId>site-maven-plugin</artifactId>
<version>0.5</version> <version>0.5</version>
<executions> <executions>
<execution> <execution>
<phase>site</phase> <phase>site</phase>
<goals> <goals>
<goal>site</goal> <goal>site</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<message>Creating site for ${project.version}.</message> <message>Creating site for ${project.version}.</message>
<outputDirectory>website</outputDirectory> <outputDirectory>website</outputDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

@ -96,6 +96,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:textSize="16sp" android:textSize="16sp"
android:textColor="#372c24" android:textColor="#372c24"
android:textAlignment="center"
android:gravity="center" android:gravity="center"
android:text="Registration failed, check your internet connection and click to retry" /> android:text="Registration failed, check your internet connection and click to retry" />

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="client_id">${clientKey}</string>
<string name="client_secret">${clientSecret}</string>
<string name="error_config">Please set the %1$s constant and recompile the app.</string> <string name="error_config">Please set the %1$s constant and recompile the app.</string>
<string name="already_registered">Device is already registered on server.</string> <string name="already_registered">Device is already registered on server.</string>
@ -52,6 +55,7 @@
<string name="device_enroll_type_cope">COPE</string> <string name="device_enroll_type_cope">COPE</string>
<string name="title_init_msg_error">Initialization Failed. Please try again.</string> <string name="title_init_msg_error">Initialization Failed. Please try again.</string>
<string name="title_head_init_error">Initialization Failed</string> <string name="title_head_init_error">Initialization Failed</string>
<string name="title_head_confirm_pin">Re-type the PIN to Confirm</string>
<!-- TEXT FIELD HINTS --> <!-- TEXT FIELD HINTS -->
<string name="hint_new_pin">New PIN Code</string> <string name="hint_new_pin">New PIN Code</string>
@ -89,9 +93,11 @@
<string name="shared_pref_message_mode">mode</string> <string name="shared_pref_message_mode">mode</string>
<string name="shared_pref_interval">interval</string> <string name="shared_pref_interval">interval</string>
<string name="username">username</string>
<string name="shared_pref_device_active">0</string> <string name="shared_pref_device_active">0</string>
<string name="shared_pref_client_id">${clientKey}</string> <string name="shared_pref_client_id">ClientID</string>
<string name="shared_pref_client_secret">${clientSecret}</string> <string name="shared_pref_client_secret">ClientSecret</string>
<!-- PARA KEYS --> <!-- PARA KEYS -->
@ -156,6 +162,7 @@
<!-- BUTTON TITLES --> <!-- BUTTON TITLES -->
<string name="button_ok">OK</string> <string name="button_ok">OK</string>
<string name="button_cancel">Cancel</string>
<!-- APPLICATION MANAGER --> <!-- APPLICATION MANAGER -->
<string name="application_mgr_download_location">/Download/</string> <string name="application_mgr_download_location">/Download/</string>
@ -171,5 +178,8 @@
<!-- Headings --> <!-- Headings -->
<string name="registration_heading">Set your server address here to start registration, i.e : www.abc.com</string> <string name="registration_heading">Set your server address here to start registration, i.e : www.abc.com</string>
<!-- Validation Errors -->
<string name="validation_pin_confirm">PINs don\'t match, Please re-enter</string>
</resources> </resources>

@ -1,12 +1,12 @@
/** /**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -27,25 +27,26 @@ public class AlertActivity extends SherlockActivity {
String message = ""; String message = "";
Button btnOK; Button btnOK;
TextView txtMessage; TextView txtMessage;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alert); setContentView(R.layout.activity_alert);
btnOK = (Button)findViewById(R.id.btnOK); btnOK = (Button) findViewById(R.id.btnOK);
txtMessage = (TextView)findViewById(R.id.txtMessage); txtMessage = (TextView) findViewById(R.id.txtMessage);
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null) { if (extras != null) {
if(extras.containsKey( getResources().getString(R.string.intent_extra_message))){ if (extras.containsKey(getResources().getString(R.string.intent_extra_message))) {
message = extras.getString( getResources().getString(R.string.intent_extra_message)); message = extras.getString(getResources().getString(R.string.intent_extra_message));
} }
} }
txtMessage.setText(message); txtMessage.setText(message);
btnOK.setOnClickListener(new OnClickListener() { btnOK.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

@ -1,12 +1,12 @@
/** /**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -21,6 +21,7 @@ import java.util.Map;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.api.PhoneState; import org.wso2.cdm.agent.api.PhoneState;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.services.LocalNotification;
import org.wso2.cdm.agent.services.Operation; import org.wso2.cdm.agent.services.Operation;
import org.wso2.cdm.agent.services.WSO2DeviceAdminReceiver; import org.wso2.cdm.agent.services.WSO2DeviceAdminReceiver;
import org.wso2.cdm.agent.utils.CommonDialogUtils; import org.wso2.cdm.agent.utils.CommonDialogUtils;
@ -52,9 +53,9 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
public class AlreadyRegisteredActivity extends SherlockActivity implements APIResultCallBack { public class AlreadyRegisteredActivity extends SherlockActivity implements APIResultCallBack {
private String TAG = AlreadyRegisteredActivity.class.getSimpleName(); private String TAG = AlreadyRegisteredActivity.class.getSimpleName();
AsyncTask<Void, Void, Void> mRegisterTask; AsyncTask<Void, Void, Void> mRegisterTask;
AsyncTask<Void, Void, Void> mCheckRegisterTask; AsyncTask<Void, Void, Void> mCheckRegisterTask;
static final int ACTIVATION_REQUEST = 47; // identifies our request id static final int ACTIVATION_REQUEST = 47; // identifies our request id
@ -84,13 +85,14 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setCustomView(R.layout.custom_sherlock_bar); getSupportActionBar().setCustomView(R.layout.custom_sherlock_bar);
getSupportActionBar().setTitle(R.string.empty_app_title); getSupportActionBar().setTitle(R.string.empty_app_title);
View homeIcon = findViewById(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? android.R.id.home View homeIcon = findViewById(
: R.id.abs__home); Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? android.R.id.home
: R.id.abs__home);
((View) homeIcon.getParent()).setVisibility(View.GONE); ((View) homeIcon.getParent()).setVisibility(View.GONE);
devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
demoDeviceAdmin = new ComponentName(this, demoDeviceAdmin = new ComponentName(this,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
operation = new Operation(AlreadyRegisteredActivity.this); operation = new Operation(AlreadyRegisteredActivity.this);
context = AlreadyRegisteredActivity.this; context = AlreadyRegisteredActivity.this;
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
@ -102,11 +104,11 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
} }
} }
String regIden = CommonUtilities
String regIden=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_regId)); .getPref(context, context.getResources().getString(R.string.shared_pref_regId));
if(!regIden.equals("")){ if (!regIden.equals("")) {
regId=regIden; regId = regIden;
} }
if (freshRegFlag) { if (freshRegFlag) {
@ -115,24 +117,26 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
.getSharedPreferences( .getSharedPreferences(
getResources().getString( getResources().getString(
R.string.shared_pref_package), R.string.shared_pref_package),
Context.MODE_PRIVATE); Context.MODE_PRIVATE
);
Editor editor = mainPref.edit(); Editor editor = mainPref.edit();
Log.e("freshRegFlag","1"); Log.e("freshRegFlag", "1");
editor.putString( editor.putString(
getResources().getString( getResources().getString(
R.string.shared_pref_registered), "1"); R.string.shared_pref_registered), "1"
);
editor.commit(); editor.commit();
if (!devicePolicyManager.isAdminActive(demoDeviceAdmin)) { if (!devicePolicyManager.isAdminActive(demoDeviceAdmin)) {
Intent intent1 = new Intent( Intent intent1 = new Intent(
DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent1.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, intent1.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
demoDeviceAdmin); demoDeviceAdmin);
intent1.putExtra( intent1.putExtra(
DevicePolicyManager.EXTRA_ADD_EXPLANATION, DevicePolicyManager.EXTRA_ADD_EXPLANATION,
getResources().getString( getResources().getString(
R.string.device_admin_enable_alert)); R.string.device_admin_enable_alert)
);
startActivityForResult(intent1, ACTIVATION_REQUEST); startActivityForResult(intent1, ACTIVATION_REQUEST);
} }
//operation.executePolicy(); //operation.executePolicy();
@ -145,26 +149,27 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
btnUnregister = (Button) findViewById(R.id.btnUnreg); btnUnregister = (Button) findViewById(R.id.btnUnreg);
btnUnregister.setTag(TAG_BTN_UNREGISTER); btnUnregister.setTag(TAG_BTN_UNREGISTER);
btnUnregister.setOnClickListener(onClickListener_BUTTON_CLICKED); btnUnregister.setOnClickListener(onClickListenerButtonClicked);
LocalNotification.startPolling(context);
} }
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
dialog.dismiss(); dialog.dismiss();
break; break;
case DialogInterface.BUTTON_NEGATIVE: case DialogInterface.BUTTON_NEGATIVE:
startUnRegistration(); startUnRegistration();
break; break;
} }
} }
}; };
OnClickListener onClickListener_BUTTON_CLICKED = new OnClickListener() { OnClickListener onClickListenerButtonClicked = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -172,51 +177,56 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
switch (iTag) { switch (iTag) {
case TAG_BTN_UNREGISTER: case TAG_BTN_UNREGISTER:
AlertDialog.Builder builder = new AlertDialog.Builder( AlertDialog.Builder builder = new AlertDialog.Builder(
AlreadyRegisteredActivity.this); AlreadyRegisteredActivity.this);
builder.setMessage(getResources().getString(R.string.dialog_unregister)) builder.setMessage(getResources().getString(R.string.dialog_unregister))
.setNegativeButton(getResources().getString(R.string.yes), dialogClickListener) .setNegativeButton(getResources().getString(R.string.yes),
.setPositiveButton(getResources().getString(R.string.no), dialogClickListener).show(); dialogClickListener)
break; .setPositiveButton(getResources().getString(R.string.no),
dialogClickListener).show();
case TAG_BTN_OPTIONS: break;
break;
case TAG_BTN_RE_REGISTER: case TAG_BTN_OPTIONS:
Intent intent = new Intent(AlreadyRegisteredActivity.this, break;
ServerDetails.class); case TAG_BTN_RE_REGISTER:
intent.putExtra( Intent intent = new Intent(AlreadyRegisteredActivity.this,
getResources().getString(R.string.intent_extra_regid), ServerDetails.class);
regId); intent.putExtra(
startActivity(intent); getResources().getString(R.string.intent_extra_regid),
finish(); regId);
break; startActivity(intent);
finish();
default: break;
break;
default:
break;
} }
} }
}; };
DialogInterface.OnClickListener isRegisteredFailedOKBtnClickListerner = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener isRegisteredFailedOKBtnClickListerner =
@Override new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) { @Override
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(AlreadyRegisteredActivity.this,
ServerDetails.class); Intent intent = new Intent(AlreadyRegisteredActivity.this,
intent.putExtra( ServerDetails.class);
getResources().getString( intent.putExtra(
R.string.intent_extra_regid), regId); getResources().getString(
intent.putExtra( R.string.intent_extra_regid), regId
getResources().getString( );
R.string.intent_extra_from_activity), intent.putExtra(
AlreadyRegisteredActivity.class.getSimpleName()); getResources().getString(
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); R.string.intent_extra_from_activity),
startActivity(intent); AlreadyRegisteredActivity.class.getSimpleName()
);
} intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}; startActivity(intent);
}
};
public void startUnRegistration() { public void startUnRegistration() {
final Context context = AlreadyRegisteredActivity.this; final Context context = AlreadyRegisteredActivity.this;
@ -224,13 +234,14 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
progressDialog = ProgressDialog progressDialog = ProgressDialog
.show(AlreadyRegisteredActivity.this, .show(AlreadyRegisteredActivity.this,
getResources().getString( getResources().getString(
R.string.dialog_message_unregistering), R.string.dialog_message_unregistering),
getResources().getString( getResources().getString(
R.string.dialog_message_please_wait), true); R.string.dialog_message_please_wait), true
);
regId = CommonUtilities.getPref(context, context.getResources() regId = CommonUtilities.getPref(context, context.getResources()
.getString(R.string.shared_pref_regId)); .getString(R.string.shared_pref_regId));
Map<String, String> requestParams = new HashMap<String, String>(); Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("regid", regId); requestParams.put("regid", regId);
@ -238,10 +249,10 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
// Check network connection availability before calling the API. // Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) { if (PhoneState.isNetworkAvailable(context)) {
// Call device unregister API. // Call device unregister API.
ServerUtils.callSecuredAPI(AlreadyRegisteredActivity.this, CommonUtilities.UNREGISTER_ENDPOINT, // ServerUtils.callSecuredAPI(AlreadyRegisteredActivity.this, CommonUtilities.UNREGISTER_ENDPOINT,
CommonUtilities.POST_METHOD, requestParams, // CommonUtilities.POST_METHOD, requestParams,
AlreadyRegisteredActivity.this, // AlreadyRegisteredActivity.this,
CommonUtilities.UNREGISTER_REQUEST_CODE); // CommonUtilities.UNREGISTER_REQUEST_CODE);
} else { } else {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils CommonDialogUtils
@ -252,9 +263,9 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
if(CommonUtilities.DEBUG_MODE_ENABLED){ if (CommonUtilities.DEBUG_MODE_ENABLED) {
getSupportMenuInflater().inflate(R.menu.sherlock_menu_debug, menu); getSupportMenuInflater().inflate(R.menu.sherlock_menu_debug, menu);
}else{ } else {
getSupportMenuInflater().inflate(R.menu.sherlock_menu, menu); getSupportMenuInflater().inflate(R.menu.sherlock_menu, menu);
} }
return true; return true;
@ -263,47 +274,50 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.info_setting: case R.id.info_setting:
Intent intentIN = new Intent(AlreadyRegisteredActivity.this, Intent intentIN = new Intent(AlreadyRegisteredActivity.this,
DisplayDeviceInfoActivity.class); DisplayDeviceInfoActivity.class);
intentIN.putExtra( intentIN.putExtra(
getResources().getString( getResources().getString(
R.string.intent_extra_from_activity), R.string.intent_extra_from_activity),
AlreadyRegisteredActivity.class.getSimpleName()); AlreadyRegisteredActivity.class.getSimpleName()
startActivity(intentIN); );
return true; startActivity(intentIN);
case R.id.pin_setting: return true;
Intent intentPIN = new Intent(AlreadyRegisteredActivity.this, case R.id.pin_setting:
PinCodeActivity.class); Intent intentPIN = new Intent(AlreadyRegisteredActivity.this,
intentPIN.putExtra( PinCodeActivity.class);
getResources().getString( intentPIN.putExtra(
R.string.intent_extra_from_activity), getResources().getString(
AlreadyRegisteredActivity.class.getSimpleName()); R.string.intent_extra_from_activity),
startActivity(intentPIN); AlreadyRegisteredActivity.class.getSimpleName()
return true; );
case R.id.ip_setting: startActivity(intentPIN);
SharedPreferences mainPref = AlreadyRegisteredActivity.this return true;
.getSharedPreferences("com.mdm", Context.MODE_PRIVATE); case R.id.ip_setting:
Editor editor = mainPref.edit(); SharedPreferences mainPref = AlreadyRegisteredActivity.this
editor.putString(getResources().getString(R.string.shared_pref_ip), .getSharedPreferences("com.mdm", Context.MODE_PRIVATE);
""); Editor editor = mainPref.edit();
editor.commit(); editor.putString(getResources().getString(R.string.shared_pref_ip),
"");
Intent intentIP = new Intent(AlreadyRegisteredActivity.this, editor.commit();
ServerDetails.class);
intentIP.putExtra( Intent intentIP = new Intent(AlreadyRegisteredActivity.this,
getResources().getString( ServerDetails.class);
R.string.intent_extra_from_activity), intentIP.putExtra(
AlreadyRegisteredActivity.class.getSimpleName()); getResources().getString(
startActivity(intentIP); R.string.intent_extra_from_activity),
return true; AlreadyRegisteredActivity.class.getSimpleName()
case R.id.debug_log: );
Intent intentDebug = new Intent(AlreadyRegisteredActivity.this, startActivity(intentIP);
LogActivity.class); return true;
startActivity(intentDebug); case R.id.debug_log:
return true; Intent intentDebug = new Intent(AlreadyRegisteredActivity.this,
default: LogActivity.class);
return super.onOptionsItemSelected(item); startActivity(intentDebug);
return true;
default:
return super.onOptionsItemSelected(item);
} }
} }
@ -320,7 +334,6 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
// finish();
Intent i = new Intent(); Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN); i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME); i.addCategory(Intent.CATEGORY_HOME);
@ -331,7 +344,6 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
i.setAction(Intent.ACTION_MAIN); i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME); i.addCategory(Intent.CATEGORY_HOME);
this.startActivity(i); this.startActivity(i);
// finish();
return true; return true;
} }
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
@ -346,16 +358,16 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
// Call isRegistered API. // Call isRegistered API.
Map<String, String> requestParams = new HashMap<String, String>(); Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("regid", regId); requestParams.put("regid", regId);
ServerUtils.callSecuredAPI(AlreadyRegisteredActivity.this, // ServerUtils.callSecuredAPI(AlreadyRegisteredActivity.this,
CommonUtilities.IS_REGISTERED_ENDPOINT, // CommonUtilities.IS_REGISTERED_ENDPOINT,
CommonUtilities.POST_METHOD, requestParams, // CommonUtilities.POST_METHOD, requestParams,
AlreadyRegisteredActivity.this, // AlreadyRegisteredActivity.this,
CommonUtilities.IS_REGISTERED_REQUEST_CODE); // CommonUtilities.IS_REGISTERED_REQUEST_CODE);
} else { } else {
CommonDialogUtils CommonDialogUtils
.showNetworkUnavailableMessage(AlreadyRegisteredActivity.this); .showNetworkUnavailableMessage(AlreadyRegisteredActivity.this);
} }
} }
} }
@ -366,20 +378,21 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
builder.setTitle(title); builder.setTitle(title);
builder.setCancelable(true); builder.setCancelable(true);
builder.setPositiveButton(getResources().getString(R.string.button_ok), builder.setPositiveButton(getResources().getString(R.string.button_ok),
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
//cancelEntry(); //cancelEntry();
dialog.cancel(); dialog.cancel();
} }
}); }
);
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
public void cancelEntry() { public void cancelEntry() {
Intent intentIP = new Intent(AlreadyRegisteredActivity.this, Intent intentIP = new Intent(AlreadyRegisteredActivity.this,
ServerDetails.class); ServerDetails.class);
intentIP.putExtra( intentIP.putExtra(
getResources().getString(R.string.intent_extra_from_activity), getResources().getString(R.string.intent_extra_from_activity),
AlreadyRegisteredActivity.class.getSimpleName()); AlreadyRegisteredActivity.class.getSimpleName());
@ -403,9 +416,9 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
btnUnregister.setText(R.string.register_button_text); btnUnregister.setText(R.string.register_button_text);
btnUnregister.setTag(TAG_BTN_RE_REGISTER); btnUnregister.setTag(TAG_BTN_RE_REGISTER);
btnUnregister btnUnregister
.setOnClickListener(onClickListener_BUTTON_CLICKED); .setOnClickListener(onClickListenerButtonClicked);
ServerUtils.clearAppData(context); ServerUtils.clearAppData(context);
} else if (responseStatus } else if (responseStatus
.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) { .equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
Log.e(TAG, "The value of status is : " + responseStatus); Log.e(TAG, "The value of status is : " + responseStatus);
@ -417,7 +430,8 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getResources().getString( getResources().getString(
R.string.error_internal_server), R.string.error_internal_server),
getResources().getString(R.string.button_ok), getResources().getString(R.string.button_ok),
null); null
);
} else { } else {
Log.e(TAG, "The result is : " + result); Log.e(TAG, "The result is : " + result);
Log.e(TAG, "The responseStatus is : " + responseStatus); Log.e(TAG, "The responseStatus is : " + responseStatus);
@ -428,7 +442,6 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
Log.e(TAG, "The responseStatus is : " + responseStatus); Log.e(TAG, "The responseStatus is : " + responseStatus);
loadAuthenticationErrorActivity(); loadAuthenticationErrorActivity();
} }
} else { } else {
Log.e(TAG, "The result is null in onReceiveAPIResult()."); Log.e(TAG, "The result is null in onReceiveAPIResult().");
@ -437,7 +450,7 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
} }
} }
if (requestCode == CommonUtilities.IS_REGISTERED_REQUEST_CODE) { if (requestCode == CommonUtilities.IS_REGISTERED_REQUEST_CODE) {
stopProgressDialog(); stopProgressDialog();
if (result != null) { if (result != null) {
@ -454,13 +467,14 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getResources().getString( getResources().getString(
R.string.error_internal_server), R.string.error_internal_server),
getResources().getString(R.string.button_ok), getResources().getString(R.string.button_ok),
null); null
);
alertDialog.show(); alertDialog.show();
} else if (!responseStatus } else if (!responseStatus
.equals(CommonUtilities.REQUEST_SUCCESSFUL)) { .equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
Log.e(TAG, "The value of status is : " + responseStatus); Log.e(TAG, "The value of status is : " + responseStatus);
ServerUtils.clearAppData(context); ServerUtils.clearAppData(context);
alertDialog = CommonDialogUtils alertDialog = CommonDialogUtils
.getAlertDialogWithOneButtonAndTitle( .getAlertDialogWithOneButtonAndTitle(
context, context,
@ -469,14 +483,15 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getResources().getString( getResources().getString(
R.string.error_for_all_unknown_registration_failures), R.string.error_for_all_unknown_registration_failures),
getResources().getString(R.string.button_ok), getResources().getString(R.string.button_ok),
isRegisteredFailedOKBtnClickListerner); isRegisteredFailedOKBtnClickListerner
);
alertDialog.show(); alertDialog.show();
ServerUtils.clearAppData(context); ServerUtils.clearAppData(context);
} }
} else { } else {
Log.e(TAG, "The result is null in onReceiveAPIResult()"); Log.e(TAG, "The result is null in onReceiveAPIResult()");
ServerUtils.clearAppData(context); ServerUtils.clearAppData(context);
alertDialog = CommonDialogUtils alertDialog = CommonDialogUtils
.getAlertDialogWithOneButtonAndTitle( .getAlertDialogWithOneButtonAndTitle(
context, context,
@ -485,15 +500,15 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getResources().getString( getResources().getString(
R.string.error_for_all_unknown_registration_failures), R.string.error_for_all_unknown_registration_failures),
getResources().getString(R.string.button_ok), getResources().getString(R.string.button_ok),
isRegisteredFailedOKBtnClickListerner); isRegisteredFailedOKBtnClickListerner
);
alertDialog.show(); alertDialog.show();
} }
} else { } else {
Log.e(TAG, "The responseStatus is null in onReceiveAPIResult()"); Log.e(TAG, "The responseStatus is null in onReceiveAPIResult()");
ServerUtils.clearAppData(context); ServerUtils.clearAppData(context);
alertDialog = CommonDialogUtils alertDialog = CommonDialogUtils
.getAlertDialogWithOneButtonAndTitle( .getAlertDialogWithOneButtonAndTitle(
context, context,
@ -502,27 +517,30 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
getResources().getString( getResources().getString(
R.string.error_for_all_unknown_registration_failures), R.string.error_for_all_unknown_registration_failures),
getResources().getString(R.string.button_ok), getResources().getString(R.string.button_ok),
null); null
);
alertDialog.show(); alertDialog.show();
} }
} }
} }
private void loadAuthenticationErrorActivity() { private void loadAuthenticationErrorActivity() {
Intent intent = new Intent(AlreadyRegisteredActivity.this, Intent intent = new Intent(AlreadyRegisteredActivity.this,
AuthenticationErrorActivity.class); AuthenticationErrorActivity.class);
intent.putExtra( intent.putExtra(
getResources().getString( getResources().getString(
R.string.intent_extra_regid), regId); R.string.intent_extra_regid), regId
);
intent.putExtra( intent.putExtra(
getResources().getString( getResources().getString(
R.string.intent_extra_from_activity), R.string.intent_extra_from_activity),
AlreadyRegisteredActivity.class.getSimpleName()); AlreadyRegisteredActivity.class.getSimpleName()
);
startActivity(intent); startActivity(intent);
} }
private void stopProgressDialog() { private void stopProgressDialog() {
if (progressDialog != null && progressDialog.isShowing()) { if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss(); progressDialog.dismiss();

@ -1,12 +1,12 @@
/** /**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,28 +15,21 @@
*/ */
package org.wso2.cdm.agent; package org.wso2.cdm.agent;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.api.PhoneState; import org.wso2.cdm.agent.api.PhoneState;
import org.wso2.cdm.agent.proxy.APIAccessCallBack; import org.wso2.cdm.agent.proxy.APIAccessCallBack;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.proxy.IdentityProxy; import org.wso2.cdm.agent.proxy.IdentityProxy;
import org.wso2.cdm.agent.services.AlarmReceiver;
import org.wso2.cdm.agent.utils.CommonDialogUtils; import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Constant; import org.wso2.cdm.agent.utils.Constant;
import org.wso2.cdm.agent.utils.HTTPConnectorUtils;
import org.wso2.cdm.agent.utils.Preference; import org.wso2.cdm.agent.utils.Preference;
import org.wso2.cdm.agent.utils.ServerUtils; import org.wso2.cdm.agent.utils.ServerUtils;
import android.app.AlarmManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.PendingIntent;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -44,11 +37,8 @@ import android.content.DialogInterface.OnCancelListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings.Secure;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
@ -64,14 +54,12 @@ import android.widget.Toast;
import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.google.android.gcm.GCMRegistrar;
/** /**
* Activity that captures username, password and device ownership details. * Activity that captures username, password and device ownership details.
*/ */
public class AuthenticationActivity extends SherlockActivity implements APIAccessCallBack, public class AuthenticationActivity extends SherlockActivity implements APIAccessCallBack,
APIResultCallBack { APIResultCallBack {
private String TAG = AuthenticationActivity.class.getSimpleName(); private String TAG = AuthenticationActivity.class.getSimpleName();
@ -98,10 +86,11 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
getSupportActionBar().setCustomView(R.layout.custom_sherlock_bar); getSupportActionBar().setCustomView(R.layout.custom_sherlock_bar);
getSupportActionBar().setTitle(R.string.empty_app_title); getSupportActionBar().setTitle(R.string.empty_app_title);
View homeIcon = View homeIcon =
(View) findViewById( (View) findViewById(
Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
? android.R.id.home ? android.R.id.home
: R.id.abs__home).getParent(); : R.id.abs__home
).getParent();
homeIcon.setVisibility(View.GONE); homeIcon.setVisibility(View.GONE);
context = AuthenticationActivity.this; context = AuthenticationActivity.this;
@ -160,11 +149,13 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(View view) { public void onClick(View view) {
if (etUsername.getText() != null && if (etUsername.getText() != null &&
!etUsername.getText().toString().trim().equals("") && !etUsername.getText().toString().trim().equals("") &&
etPassword.getText() != null && !etPassword.getText().toString().trim().equals("")) { etPassword.getText() != null &&
!etPassword.getText().toString().trim().equals("")) {
passwordVal = etPassword.getText().toString().trim(); passwordVal = etPassword.getText().toString().trim();
usernameVal = etUsername.getText().toString().trim(); usernameVal = etUsername.getText().toString().trim();
if (etDomain.getText() != null && !etDomain.getText().toString().trim().equals("")) { if (etDomain.getText() != null &&
!etDomain.getText().toString().trim().equals("")) {
usernameVal += "@" + etDomain.getText().toString().trim(); usernameVal += "@" + etDomain.getText().toString().trim();
} }
@ -180,13 +171,21 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
messageBuilder.append(" "); messageBuilder.append(" ");
messageBuilder.append(getResources().getString(R.string.dialog_init_end)); messageBuilder.append(getResources().getString(R.string.dialog_init_end));
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context,
getResources().getString(R.string.dialog_init_device_type), getResources()
messageBuilder.toString(), .getString(
getResources().getString(R.string.yes), R.string.dialog_init_device_type),
getResources().getString(R.string.no), messageBuilder
dialogClickListener, .toString(),
dialogClickListener); getResources()
.getString(
R.string.yes),
getResources()
.getString(
R.string.no),
dialogClickListener,
dialogClickListener
);
alertDialog.show(); alertDialog.show();
} else { } else {
if (etUsername.getText() != null && if (etUsername.getText() != null &&
@ -209,12 +208,12 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
startAuthentication();
dialog.dismiss(); dialog.dismiss();
break; break;
case DialogInterface.BUTTON_NEGATIVE: case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss(); dialog.dismiss();
startAuthentication();
break; break;
} }
} }
@ -224,10 +223,12 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
* Start authentication process. * Start authentication process.
*/ */
public void startAuthentication() { public void startAuthentication() {
Preference.put(context, getResources().getString(R.string.shared_pref_reg_type), deviceType); Preference
.put(context, getResources().getString(R.string.shared_pref_reg_type), deviceType);
// Check network connection availability before calling the API. // Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) { if (PhoneState.isNetworkAvailable(context)) {
authenticate(); initializeIDPLib(getResources().getString(R.string.client_id),
getResources().getString(R.string.client_secret));
} else { } else {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils.showNetworkUnavailableMessage(context); CommonDialogUtils.showNetworkUnavailableMessage(context);
@ -236,93 +237,85 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
} }
/** /**
* Communicating with the server to authenticate user. * Initialize the Android IDP SDK by passing credentials,client ID and
* client secret.
*
* @param clientKey client id value to access APIs..
* @param clientSecret client secret value to access APIs.
*/ */
private void authenticate() { private void initializeIDPLib(String clientKey, String clientSecret) {
String serverIP =
AsyncTask<Void, Void, Map<String, String>> mLicenseTask = CommonUtilities.getPref(AuthenticationActivity.this,
new AsyncTask<Void, Void, Map<String, String>>() { context.getResources()
.getString(R.string.shared_pref_ip)
@Override );
protected Map<String, String> doInBackground(Void... params) { String serverURL =
Map<String, String> response = CommonUtilities.SERVER_PROTOCOL + serverIP + ":" +
null; CommonUtilities.SERVER_PORT + CommonUtilities.OAUTH_ENDPOINT;
if (etDomain.getText() != null && !etDomain.getText().toString().trim().equals("")) {
Map<String, String> requestParametres = usernameForRegister =
new HashMap<String, String>(); etUsername.getText().toString().trim() + "@" +
etDomain.getText().toString().trim();
requestParametres.put(Constant.USERNAME, } else {
usernameVal); usernameForRegister = etUsername.getText().toString().trim();
requestParametres.put(Constant.PASSWORD, }
passwordVal); IdentityProxy.getInstance().init(clientKey, clientSecret, usernameForRegister, passwordVal,
response = serverURL, AuthenticationActivity.this,
HTTPConnectorUtils.postData(context, this.getApplicationContext());
CommonUtilities.SERVER_URL + }
CommonUtilities.SERVER_AUTHENTICATION_ENDPOINT,
requestParametres);
return response;
}
@Override @Override
protected void onPreExecute() { public void onAPIAccessRecive(String status) {
progressDialog = if (status != null) {
ProgressDialog.show(context, if (status.trim().equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
getResources().getString(R.string.dialog_authenticate),
getResources().getString(R.string.dialog_please_wait),
true);
}; SharedPreferences mainPref =
this.getSharedPreferences(
getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_username),
usernameForRegister);
editor.commit();
@Override // Check network connection availability before calling the API.
protected void onPostExecute(Map<String, String> result) { if (PhoneState.isNetworkAvailable(context)) {
authenticateResponse(result); getLicense();
} else {
CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils.showNetworkUnavailableMessage(AuthenticationActivity.this);
}
} } else if (status.trim().equals(CommonUtilities.AUTHENTICATION_FAILED)) {
CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources()
.getString(
R.string.title_head_authentication_error),
getResources()
.getString(
R.string.error_authentication_failed),
getResources()
.getString(
R.string.button_ok),
dialogClickListener
);
} else if (status.trim().equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
showInternalServerErrorMessage();
}; } else {
Log.e(TAG, "Status: " + status);
showAuthCommonErrorMessage();
}
mLicenseTask.execute(); } else {
Log.e(TAG, "The value of status is null in onAPIAccessRecive()");
showAuthCommonErrorMessage();
}
} }
/**
* Handles the response received from server for the authentication request.
* @param result Received response from server.
*/
private void authenticateResponse(Map<String, String> result){
if (result != null) {
String responseStatus =
result.get(Constant.STATUS);
if (responseStatus != null) {
if (responseStatus.equalsIgnoreCase(CommonUtilities.REQUEST_SUCCESSFUL)) {
getLicense();
} else if (responseStatus.equalsIgnoreCase(CommonUtilities.UNAUTHORIZED_ACCESS)) {
CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_authentication_error),
getResources().getString(R.string.error_authentication_failed),
getResources().getString(R.string.button_ok),
dialogClickListener);
} else if (responseStatus.trim()
.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
Log.e(TAG, "Error: Internal server error");
showInternalServerErrorMessage();
} else {
Log.e(TAG, "Status: " + responseStatus);
showAuthCommonErrorMessage();
}
} else {
Log.e(TAG, "The value of status is null in authenticating");
showAuthCommonErrorMessage();
}
} else {
Log.e(TAG, "The result is null in authenticating");
showAuthCommonErrorMessage();
}
}
/** /**
* Initialize get device license agreement. Check if the user has already * Initialize get device license agreement. Check if the user has already
@ -330,11 +323,11 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
*/ */
private void getLicense() { private void getLicense() {
String licenseAgreedResponse = String licenseAgreedResponse =
Preference.get(context, Preference.get(context,
getResources().getString(R.string.shared_pref_isagreed)); getResources().getString(R.string.shared_pref_isagreed));
String type = String type =
Preference.get(context, Preference.get(context,
getResources().getString(R.string.shared_pref_reg_type)); getResources().getString(R.string.shared_pref_reg_type));
// No need to display license for COPE devices // No need to display license for COPE devices
if (type.trim().equals(getResources().getString(R.string.device_enroll_type_byod))) { if (type.trim().equals(getResources().getString(R.string.device_enroll_type_byod))) {
@ -346,18 +339,28 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
@Override @Override
public void onCancel(DialogInterface arg0) { public void onCancel(DialogInterface arg0) {
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_enrollment_failed_detail), getResources()
getResources().getString(R.string.error_enrollment_failed), .getString(
getResources().getString(R.string.button_ok), R.string.error_enrollment_failed_detail),
null); getResources()
.getString(
R.string.error_enrollment_failed),
getResources()
.getString(
R.string.button_ok),
null
);
} }
}; };
progressDialog = progressDialog =
CommonDialogUtils.showPrgressDialog(context, CommonDialogUtils.showPrgressDialog(context,
getResources().getString(R.string.dialog_license_agreement), getResources().getString(
getResources().getString(R.string.dialog_please_wait), R.string.dialog_license_agreement),
cancelListener); getResources().getString(
R.string.dialog_please_wait),
cancelListener
);
// Check network connection availability before calling the API. // Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) { if (PhoneState.isNetworkAvailable(context)) {
@ -377,46 +380,31 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
} }
/** /**
* Retriever license agreement details from the server * Retriever license agreement details from the server.
*/ */
private void getLicenseFromServer() { private void getLicenseFromServer() {
ServerUtils.callSecuredAPI(AuthenticationActivity.this,
CommonUtilities.API_SERVER_URL +
CommonUtilities.LICENSE_ENDPOINT,
CommonUtilities.GET_METHOD, null,
AuthenticationActivity.this,
CommonUtilities.LICENSE_REQUEST_CODE
);
}
AsyncTask<Void, Void, Map<String, String>> mLicenseTask = @Override
new AsyncTask<Void, Void, Map<String, String>>() { public void onReceiveAPIResult(Map<String, String> result, int requestCode) {
if (requestCode == CommonUtilities.SENDER_ID_REQUEST_CODE) {
@Override //manipulateSenderIdResponse(result);
protected Map<String, String> doInBackground(Void... params) { } else if (requestCode == CommonUtilities.LICENSE_REQUEST_CODE) {
Map<String, String> response = manipulateLicenseResponse(result);
null; }
response =
HTTPConnectorUtils.postData(context,
CommonUtilities.SERVER_URL +
CommonUtilities.LICENSE_ENDPOINT,
null);
return response;
}
@Override
protected void onPreExecute() {
};
@Override
protected void onPostExecute(Map<String, String> result) {
CommonDialogUtils.stopProgressDialog(progressDialog);
manipulateLicenseResponse(result);
}
};
mLicenseTask.execute();
} }
/** /**
* Manipulates the License agreement response received from server. * Manipulates the License agreement response received from server.
* *
* @param result * @param result the result of the license agreement request
* the result of the license agreement request
*/ */
private void manipulateLicenseResponse(Map<String, String> result) { private void manipulateLicenseResponse(Map<String, String> result) {
String responseStatus; String responseStatus;
@ -432,8 +420,9 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
licenseAgreement); licenseAgreement);
showAgreement(licenseAgreement, CommonUtilities.EULA_TITLE); showAgreement(licenseAgreement, CommonUtilities.EULA_TITLE);
} else { } else {
showErrorMessage(getResources().getString(R.string.error_enrollment_failed_detail), showErrorMessage(
getResources().getString(R.string.error_enrollment_failed)); getResources().getString(R.string.error_enrollment_failed_detail),
getResources().getString(R.string.error_enrollment_failed));
} }
} else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) { } else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
@ -460,11 +449,18 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
cancelEntry(); cancelEntry();
dialog.dismiss(); dialog.dismiss();
} }
}); }
);
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
/**
* Show the license text retrieved from the server.
*
* @param message Message text to be shown as the license.
* @param title Title of the license.
*/
public void showAgreement(String message, String title) { public void showAgreement(String message, String title) {
final Dialog dialog = new Dialog(context); final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom_terms_popup); dialog.setContentView(R.layout.custom_terms_popup);
@ -523,8 +519,8 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void cancelEntry() { public void cancelEntry() {
SharedPreferences mainPref = SharedPreferences mainPref =
context.getSharedPreferences(getResources().getString(R.string.shared_pref_package), context.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE); Context.MODE_PRIVATE);
Editor editor = mainPref.edit(); Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_policy), ""); editor.putString(getResources().getString(R.string.shared_pref_policy), "");
editor.putString(getResources().getString(R.string.shared_pref_isagreed), "0"); editor.putString(getResources().getString(R.string.shared_pref_isagreed), "0");
@ -551,7 +547,8 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
// cancelEntry(); // cancelEntry();
dialog.cancel(); dialog.cancel();
} }
}); }
);
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
@ -566,44 +563,15 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
dialog.dismiss(); dialog.dismiss();
} }
}); }
);
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
/** /**
* Initialize the Android IDP sdk by passing user credentials,client ID and * Validation done to see if the username and password fields are properly entered.
* client secret.
*/ */
private void initializeIDPLib(String clientKey, String clientSecret) {
Log.e("", "initializeIDPLib");
String serverIP =
CommonUtilities.getPref(AuthenticationActivity.this,
context.getResources()
.getString(R.string.shared_pref_ip));
String serverURL =
CommonUtilities.SERVER_PROTOCOL + serverIP + ":" +
CommonUtilities.SERVER_PORT + CommonUtilities.OAUTH_ENDPOINT;
if (etDomain.getText() != null && !etDomain.getText().toString().trim().equals("")) {
usernameForRegister =
etUsername.getText().toString().trim() + "@" +
etDomain.getText().toString().trim();
IdentityProxy.getInstance().init(clientKey, clientSecret, usernameForRegister,
etPassword.getText().toString().trim(), serverURL,
AuthenticationActivity.this,
this.getApplicationContext());
} else {
usernameForRegister = etUsername.getText().toString().trim();
IdentityProxy.getInstance().init(clientKey, clientSecret, usernameForRegister,
etPassword.getText().toString().trim(), serverURL,
AuthenticationActivity.this,
this.getApplicationContext());
}
}
public void enableSubmitIfReady() { public void enableSubmitIfReady() {
boolean isReady = false; boolean isReady = false;
@ -626,7 +594,6 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
getSupportMenuInflater().inflate(R.menu.auth_sherlock_menu, menu); getSupportMenuInflater().inflate(R.menu.auth_sherlock_menu, menu);
return true; return true;
} }
@ -636,8 +603,9 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.ip_setting: case R.id.ip_setting:
SharedPreferences mainPref = SharedPreferences mainPref =
AuthenticationActivity.this.getSharedPreferences(getResources().getString(R.string.shared_pref_package), AuthenticationActivity.this.getSharedPreferences(
Context.MODE_PRIVATE); getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit(); Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_ip), ""); editor.putString(getResources().getString(R.string.shared_pref_ip), "");
editor.commit(); editor.commit();
@ -668,222 +636,62 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
} }
DialogInterface.OnClickListener senderIdFailedClickListener = DialogInterface.OnClickListener senderIdFailedClickListener =
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int which) { int which) {
etUsername.setText(CommonUtilities.EMPTY_STRING); etUsername.setText(CommonUtilities.EMPTY_STRING);
etPassword.setText(CommonUtilities.EMPTY_STRING); etPassword.setText(CommonUtilities.EMPTY_STRING);
etDomain.setText(CommonUtilities.EMPTY_STRING); etDomain.setText(CommonUtilities.EMPTY_STRING);
btnRegister.setEnabled(false); btnRegister.setEnabled(false);
btnRegister.setBackground(getResources().getDrawable(R.drawable.btn_grey)); btnRegister.setBackground(getResources().getDrawable(R.drawable.btn_grey));
btnRegister.setTextColor(getResources().getColor(R.color.black)); btnRegister.setTextColor(getResources().getColor(R.color.black));
} }
}; };
@Override
public void onReceiveAPIResult(Map<String, String> result, int requestCode) {
if (requestCode == CommonUtilities.SENDER_ID_REQUEST_CODE) {
Log.e("sender", "rec" + result);
manipulateSenderIdResponse(result);
} else if (requestCode == CommonUtilities.LICENSE_REQUEST_CODE) {
manipulateLicenseResponse(result);
}
}
private void showEnrollementFailedErrorMessage() { private void showEnrollementFailedErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_enrollment_failed), getResources().getString(
getResources().getString(R.string.error_enrollment_failed_detail), R.string.error_enrollment_failed),
getResources().getString(R.string.button_ok), getResources().getString(
senderIdFailedClickListener); R.string.error_enrollment_failed_detail),
} getResources().getString(
R.string.button_ok),
private void managePushNotification(String mode, float interval, Editor editor) { senderIdFailedClickListener
if (mode.trim().toUpperCase().contains("LOCAL")) { );
CommonUtilities.LOCAL_NOTIFICATIONS_ENABLED = true;
CommonUtilities.GCM_ENABLED = false;
String androidID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
// if (senderId == null || senderId.equals("")) {
editor.putString(getResources().getString(R.string.shared_pref_regId), androidID);
// }
editor.commit();
startLocalNotification(interval);
} else if (mode.trim().toUpperCase().contains("GCM")) {
CommonUtilities.LOCAL_NOTIFICATIONS_ENABLED = false;
CommonUtilities.GCM_ENABLED = true;
// editor.commit();
GCMRegistrar.register(context, CommonUtilities.SENDER_ID);
}
// if (senderId!=null && !senderId.equals("")) {
// CommonUtilities.GCM_ENABLED = true;
// GCMRegistrar.register(context, CommonUtilities.SENDER_ID);
// }
}
@Override
public void onAPIAccessRecive(String status) {
if (status != null) {
if (status.trim().equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
SharedPreferences mainPref =
this.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_username),
usernameForRegister);
editor.commit();
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("domain", etDomain.getText().toString().trim());
// Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) {
// Call get sender ID API.
Log.e("sender id ", "call");
ServerUtils.callSecuredAPI(AuthenticationActivity.this,
CommonUtilities.SENDER_ID_ENDPOINT,
CommonUtilities.GET_METHOD, requestParams,
AuthenticationActivity.this,
CommonUtilities.SENDER_ID_REQUEST_CODE);
} else {
CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils.showNetworkUnavailableMessage(AuthenticationActivity.this);
}
} else if (status.trim().equals(CommonUtilities.AUTHENTICATION_FAILED)) {
CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_authentication_error),
getResources().getString(R.string.error_authentication_failed),
getResources().getString(R.string.button_ok),
dialogClickListener);
} else if (status.trim().equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
showInternalServerErrorMessage();
} else {
Log.e(TAG, "Status: " + status);
showAuthCommonErrorMessage();
}
} else {
Log.e(TAG, "The value of status is null in onAPIAccessRecive()");
showAuthCommonErrorMessage();
}
} }
private void showInternalServerErrorMessage() { private void showInternalServerErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_connection_error), getResources().getString(
getResources().getString(R.string.error_internal_server), R.string.title_head_connection_error),
getResources().getString(R.string.button_ok), getResources().getString(
null); R.string.error_internal_server),
getResources().getString(
R.string.button_ok),
null
);
} }
/** /**
* Shows common error message for authentication. * Shows common error message for authentication.
*
*/ */
private void showAuthCommonErrorMessage() { private void showAuthCommonErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_authentication_error), getResources().getString(
getResources().getString(R.string.error_for_all_unknown_authentication_failures), R.string.title_head_authentication_error),
getResources().getString(R.string.button_ok), getResources().getString(
null); R.string.error_for_all_unknown_authentication_failures),
getResources().getString(
R.string.button_ok),
null
);
} }
private void startLocalNotification(Float interval) {
long firstTime = SystemClock.elapsedRealtime();
firstTime += 1 * 1000;
Intent downloader = new Intent(context, AlarmReceiver.class);
PendingIntent recurringDownload =
PendingIntent.getBroadcast(context,
0,
downloader,
PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Float seconds = interval;
if (interval < 1.0) {
alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime,
seconds.intValue(), recurringDownload);
} else {
alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime,
seconds.intValue(), recurringDownload);
}
}
/**
* Manipulates the sender ID response.
*
* @param result
* the result of the sender ID request
*/
private void manipulateSenderIdResponse(Map<String, String> result) {
String responseStatus;
JSONObject response;
String mode = "";
Float interval = (float) 1.0;
CommonDialogUtils.stopProgressDialog(progressDialog);
if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
try {
response = new JSONObject(result.get(Constant.RESPONSE));
senderId = response.getString("sender_id");
mode = response.getString("notifier");
interval = (float) Float.parseFloat(response.getString("notifierInterval"));
} catch (JSONException e) {
e.printStackTrace();
}
SharedPreferences mainPref =
context.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
if (senderId != null && !senderId.equals("")) {
CommonUtilities.setSENDER_ID(senderId);
GCMRegistrar.register(context, senderId);
editor.putString(getResources().getString(R.string.shared_pref_sender_id),
senderId);
}
editor.putString(getResources().getString(R.string.shared_pref_message_mode), mode);
editor.putFloat(getResources().getString(R.string.shared_pref_interval), interval);
editor.commit();
managePushNotification(mode, interval, editor);
getLicense();
} else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
Log.e(TAG, "The result is : " + result);
showInternalServerErrorMessage();
} else {
Log.e(TAG, "The result is : " + result);
showEnrollementFailedErrorMessage();
}
} else {
Log.e(TAG, "The result is null in manipulateSenderIdResponse()");
showEnrollementFailedErrorMessage();
}
}
} }

@ -19,7 +19,7 @@ package org.wso2.cdm.agent;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.api.ApplicationManager; import org.wso2.cdm.agent.api.ApplicationManager;
import org.wso2.cdm.agent.services.Config; import org.wso2.cdm.agent.services.Config;
import org.wso2.cdm.agent.services.ProcessMessage; import org.wso2.cdm.agent.services.MessageProcessor;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import android.app.Notification; import android.app.Notification;
@ -41,7 +41,7 @@ public class GCMIntentService extends GCMBaseIntentService {
DevicePolicyManager devicePolicyManager; DevicePolicyManager devicePolicyManager;
ApplicationManager appList; ApplicationManager appList;
static final int ACTIVATION_REQUEST = 47; static final int ACTIVATION_REQUEST = 47;
ProcessMessage processMsg = null; MessageProcessor processMsg = null;
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
private static final String TAG = "GCMIntentService"; private static final String TAG = "GCMIntentService";
@ -89,8 +89,8 @@ public class GCMIntentService extends GCMBaseIntentService {
String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode)); String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode));
if(mode.trim().toUpperCase().equals("GCM")){ if(mode.trim().toUpperCase().equals("GCM")){
Log.e("onmsg","GCM"); Log.e("onmsg","GCM");
ProcessMessage msg=new ProcessMessage(context); MessageProcessor msg=new MessageProcessor(context);
msg.getOperations(null); msg.getMessages();
} }
else{ else{
Log.e("onmsg","mode"); Log.e("onmsg","mode");

@ -1,12 +1,12 @@
/** /**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -15,7 +15,6 @@
*/ */
package org.wso2.cdm.agent; package org.wso2.cdm.agent;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -23,7 +22,6 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -35,8 +33,12 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.text.InputType;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.Preference; import org.wso2.cdm.agent.utils.Preference;
public class PinCodeActivity extends Activity { public class PinCodeActivity extends Activity {
@ -45,62 +47,62 @@ public class PinCodeActivity extends Activity {
private EditText txtOldPin; private EditText txtOldPin;
private Button btnPin; private Button btnPin;
private String username = null; private String username = null;
private String REG_ID = ""; private String regId = "";
private final int TAG_BTN_SET_PIN = 0; private final int TAG_BTN_SET_PIN = 0;
private String FROM_ACTIVITY = null; private String fromActivity = null;
private String MAIN_ACTIVITY = null;
Context context; Context context;
AlertDialog.Builder alertDialog;
EditText input;
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pin_code); setContentView(R.layout.activity_pin_code);
context=PinCodeActivity.this; context = PinCodeActivity.this;
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if (extras != null) { if (extras != null) {
if (extras.containsKey(getResources().getString(R.string.intent_extra_username))) { if (extras.containsKey(getResources().getString(R.string.intent_extra_username))) {
username = extras.getString(getResources().getString(R.string.intent_extra_username)); username =
extras.getString(getResources().getString(R.string.intent_extra_username));
} }
if (extras.containsKey(getResources().getString(R.string.intent_extra_regid))) { if (extras.containsKey(getResources().getString(R.string.intent_extra_regid))) {
REG_ID = extras.getString(getResources().getString(R.string.intent_extra_regid)); regId = extras.getString(getResources().getString(R.string.intent_extra_regid));
}
if(extras.containsKey(getResources().getString(R.string.intent_extra_from_activity))){
FROM_ACTIVITY = extras.getString(getResources().getString(R.string.intent_extra_from_activity));
} }
if(extras.containsKey(getResources().getString(R.string.intent_extra_main_activity))){ if (extras.containsKey(getResources().getString(R.string.intent_extra_from_activity))) {
MAIN_ACTIVITY = extras.getString(getResources().getString(R.string.intent_extra_main_activity)); fromActivity = extras.getString(
getResources().getString(R.string.intent_extra_from_activity));
} }
} }
lblPin = (TextView) findViewById(R.id.lblPin); lblPin = (TextView) findViewById(R.id.lblPin);
txtPin = (EditText) findViewById(R.id.txtPinCode); txtPin = (EditText) findViewById(R.id.txtPinCode);
txtOldPin = (EditText) findViewById(R.id.txtOldPinCode); txtOldPin = (EditText) findViewById(R.id.txtOldPinCode);
btnPin = (Button) findViewById(R.id.btnSetPin); btnPin = (Button) findViewById(R.id.btnSetPin);
btnPin.setTag(TAG_BTN_SET_PIN); btnPin.setTag(TAG_BTN_SET_PIN);
btnPin.setOnClickListener(onClickListener_BUTTON_CLICKED); btnPin.setOnClickListener(onClickListenerButtonClicked);
btnPin.setEnabled(false); btnPin.setEnabled(false);
btnPin.setBackground(getResources().getDrawable(R.drawable.btn_grey)); btnPin.setBackground(getResources().getDrawable(R.drawable.btn_grey));
btnPin.setTextColor(getResources().getColor(R.color.black)); btnPin.setTextColor(getResources().getColor(R.color.black));
if(FROM_ACTIVITY != null && FROM_ACTIVITY.equals(AlreadyRegisteredActivity.class.getSimpleName())){ if (fromActivity != null &&
fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName())) {
lblPin.setVisibility(View.GONE); lblPin.setVisibility(View.GONE);
txtOldPin.setVisibility(View.VISIBLE); txtOldPin.setVisibility(View.VISIBLE);
txtPin.setHint(getResources().getString(R.string.hint_new_pin)); txtPin.setHint(getResources().getString(R.string.hint_new_pin));
txtPin.setEnabled(true); txtPin.setEnabled(true);
txtPin.addTextChangedListener(new TextWatcher() { txtPin.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, public void beforeTextChanged(CharSequence s, int start, int count,
int after) { int after) {
} }
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, public void onTextChanged(CharSequence s, int start, int before,
int count) { int count) {
enableNewPINSubmitIfReady(); enableNewPINSubmitIfReady();
} }
@ -109,16 +111,16 @@ public class PinCodeActivity extends Activity {
enableSubmitIfReady(); enableSubmitIfReady();
} }
}); });
txtOldPin.addTextChangedListener(new TextWatcher() { txtOldPin.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, public void beforeTextChanged(CharSequence s, int start, int count,
int after) { int after) {
} }
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, public void onTextChanged(CharSequence s, int start, int before,
int count) { int count) {
enableNewPINSubmitIfReady(); enableNewPINSubmitIfReady();
} }
@ -127,16 +129,16 @@ public class PinCodeActivity extends Activity {
enableSubmitIfReady(); enableSubmitIfReady();
} }
}); });
}else{ } else {
txtPin.addTextChangedListener(new TextWatcher() { txtPin.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, public void beforeTextChanged(CharSequence s, int start, int count,
int after) { int after) {
} }
@Override @Override
public void onTextChanged(CharSequence s, int start, int before, public void onTextChanged(CharSequence s, int start, int before,
int count) { int count) {
enableSubmitIfReady(); enableSubmitIfReady();
} }
@ -148,26 +150,48 @@ public class PinCodeActivity extends Activity {
} }
} }
OnClickListener onClickListener_BUTTON_CLICKED = new OnClickListener() { OnClickListener onClickListenerButtonClicked = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
int iTag = (Integer) view.getTag(); int viewTag = (Integer) view.getTag();
switch (iTag) { switch (viewTag) {
case TAG_BTN_SET_PIN: case TAG_BTN_SET_PIN:
AlertDialog.Builder builder = new AlertDialog.Builder( input = new EditText(PinCodeActivity.this);
PinCodeActivity.this); alertDialog = CommonDialogUtils
builder.setMessage( .getAlertDialogWithTwoButtonAndEditView(PinCodeActivity.this,
getResources().getString(R.string.dialog_pin_confirmation) getResources().getString(
+ " " +txtPin.getText().toString() + " " R.string.title_head_confirm_pin)
+ getResources().getString(R.string.dialog_pin_confirmation_end)) , getResources().getString(R.string.button_ok),
.setPositiveButton(getResources().getString(R.string.yes), dialogClickListener) getResources().getString(
.setNegativeButton(getResources().getString(R.string.no), dialogClickListener).show(); R.string.button_cancel),
break; dialogClickListener,
default: dialogClickListener, input);
break;
final AlertDialog dialog = alertDialog.create();
dialog.show();
//Overriding default positive button behavior to keep the dialog open, if PINS don't match
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (txtPin.getText().toString()
.equals(input.getText().toString())) {
savePin();
dialog.dismiss();
} else {
input.setError(getResources().getString(
R.string.validation_pin_confirm));
}
}
});
input.setInputType(InputType.TYPE_CLASS_NUMBER);
input.setTransformationMethod(new PasswordTransformationMethod());
break;
default:
break;
} }
} }
@ -177,29 +201,34 @@ public class PinCodeActivity extends Activity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
savePin(); savePin();
break; break;
case DialogInterface.BUTTON_NEGATIVE: case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss(); dialog.dismiss();
break; break;
} }
} }
}; };
public void savePin() { public void savePin() {
Preference.put(context, getResources().getString(R.string.shared_pref_pin), txtPin.getText().toString().trim()); Preference.put(context, getResources().getString(R.string.shared_pref_pin),
txtPin.getText().toString().trim());
if(FROM_ACTIVITY != null && (FROM_ACTIVITY.equals(AlreadyRegisteredActivity.class.getSimpleName()))){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.toast_message_pin_change_success), Toast.LENGTH_SHORT).show(); if (fromActivity != null &&
Intent intent = new Intent(PinCodeActivity.this,AlreadyRegisteredActivity.class); (fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName()))) {
intent.putExtra(getResources().getString(R.string.intent_extra_from_activity), PinCodeActivity.class.getSimpleName()); Toast.makeText(getApplicationContext(),
intent.putExtra(getResources().getString(R.string.intent_extra_regid), REG_ID); getResources().getString(R.string.toast_message_pin_change_success),
startActivity(intent); Toast.LENGTH_SHORT).show();
}else{ Intent intent = new Intent(PinCodeActivity.this, AlreadyRegisteredActivity.class);
intent.putExtra(getResources().getString(R.string.intent_extra_from_activity),
PinCodeActivity.class.getSimpleName());
intent.putExtra(getResources().getString(R.string.intent_extra_regid), regId);
startActivity(intent);
} else {
Intent intent = new Intent(PinCodeActivity.this, RegistrationActivity.class); Intent intent = new Intent(PinCodeActivity.this, RegistrationActivity.class);
intent.putExtra(getResources().getString(R.string.intent_extra_regid), REG_ID); intent.putExtra(getResources().getString(R.string.intent_extra_regid), regId);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(getResources().getString(R.string.intent_extra_username), username); intent.putExtra(getResources().getString(R.string.intent_extra_username), username);
startActivity(intent); startActivity(intent);
@ -225,29 +254,34 @@ public class PinCodeActivity extends Activity {
btnPin.setEnabled(false); btnPin.setEnabled(false);
} }
} }
@SuppressLint("NewApi") @SuppressLint("NewApi")
public void enableNewPINSubmitIfReady() { public void enableNewPINSubmitIfReady() {
boolean isReady = false; boolean isReady = false;
SharedPreferences mainPref = this.getSharedPreferences(getResources().getString(R.string.shared_pref_package), SharedPreferences mainPref =
Context.MODE_PRIVATE); this.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
String pin = mainPref.getString(getResources().getString(R.string.shared_pref_pin), ""); String pin = mainPref.getString(getResources().getString(R.string.shared_pref_pin), "");
if(txtOldPin.getText().toString().trim().length() >= 4 && txtOldPin.getText().toString().trim().equals(pin.trim())){ if (txtOldPin.getText().toString().trim().length() >= 4 &&
txtOldPin.getText().toString().trim().equals(pin.trim())) {
txtPin.setEnabled(true); txtPin.setEnabled(true);
}else{ } else {
txtPin.setEnabled(false); txtPin.setEnabled(false);
} }
if (txtPin.getText().toString().trim().length() >= 4 && txtOldPin.getText().toString().trim().length() >= 4) { if (txtPin.getText().toString().trim().length() >= 4 &&
if(txtOldPin.getText().toString().trim().equals(pin.trim())){ txtOldPin.getText().toString().trim().length() >= 4) {
if (txtOldPin.getText().toString().trim().equals(pin.trim())) {
isReady = true; isReady = true;
}else{ } else {
isReady = false; isReady = false;
Toast.makeText(getApplicationContext(), getResources().getString(R.string.toast_message_pin_change_failed), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),
getResources().getString(R.string.toast_message_pin_change_failed),
Toast.LENGTH_SHORT).show();
} }
} }
if (isReady) { if (isReady) {
btnPin.setBackground(getResources().getDrawable(R.drawable.btn_orange)); btnPin.setBackground(getResources().getDrawable(R.drawable.btn_orange));
btnPin.setTextColor(getResources().getColor(R.color.white)); btnPin.setTextColor(getResources().getColor(R.color.white));
@ -258,30 +292,30 @@ public class PinCodeActivity extends Activity {
btnPin.setEnabled(false); btnPin.setEnabled(false);
} }
} }
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && FROM_ACTIVITY != null && FROM_ACTIVITY.equals(AlreadyRegisteredActivity.class.getSimpleName())) { if (keyCode == KeyEvent.KEYCODE_BACK && fromActivity != null &&
Intent intent = new Intent(PinCodeActivity.this,AlreadyRegisteredActivity.class); fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName())) {
intent.putExtra(getResources().getString(R.string.intent_extra_from_activity), PinCodeActivity.class.getSimpleName()); Intent intent = new Intent(PinCodeActivity.this, AlreadyRegisteredActivity.class);
intent.putExtra(getResources().getString(R.string.intent_extra_regid), REG_ID); intent.putExtra(getResources().getString(R.string.intent_extra_from_activity),
startActivity(intent); PinCodeActivity.class.getSimpleName());
return true; intent.putExtra(getResources().getString(R.string.intent_extra_regid), regId);
}else if (keyCode == KeyEvent.KEYCODE_BACK) { startActivity(intent);
Intent i = new Intent(); return true;
i.setAction(Intent.ACTION_MAIN); } else if (keyCode == KeyEvent.KEYCODE_BACK) {
i.addCategory(Intent.CATEGORY_HOME); Intent i = new Intent();
this.startActivity(i); i.setAction(Intent.ACTION_MAIN);
this.finish(); i.addCategory(Intent.CATEGORY_HOME);
return true; this.startActivity(i);
} this.finish();
return super.onKeyDown(keyCode, event); return true;
}
return super.onKeyDown(keyCode, event);
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.pin_code, menu);
return true; return true;
} }

@ -15,9 +15,9 @@
*/ */
package org.wso2.cdm.agent; package org.wso2.cdm.agent;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
@ -26,25 +26,21 @@ import org.wso2.cdm.agent.api.PhoneState;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.utils.CommonDialogUtils; import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.HTTPConnectorUtils;
import org.wso2.cdm.agent.utils.Preference; import org.wso2.cdm.agent.utils.Preference;
import org.wso2.cdm.agent.utils.ServerUtils; import org.wso2.cdm.agent.utils.ServerUtils;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.app.admin.DevicePolicyManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.TextView;
public class RegistrationActivity extends Activity implements APIResultCallBack { public class RegistrationActivity extends Activity implements APIResultCallBack {
@ -77,7 +73,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
DeviceInfo deviceInfo = new DeviceInfo(RegistrationActivity.this); DeviceInfo deviceInfo = new DeviceInfo(RegistrationActivity.this);
JSONObject jsObject = new JSONObject(); JSONObject jsObject = new JSONObject();
String osVersion = "";
SharedPreferences mainPref = SharedPreferences mainPref =
RegistrationActivity.this.getSharedPreferences(RegistrationActivity.this.getResources() RegistrationActivity.this.getSharedPreferences(RegistrationActivity.this.getResources()
.getString(R.string.shared_pref_package), .getString(R.string.shared_pref_package),
@ -86,33 +81,54 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
mainPref.getString(RegistrationActivity.this.getResources() mainPref.getString(RegistrationActivity.this.getResources()
.getString(R.string.shared_pref_reg_type), .getString(R.string.shared_pref_reg_type),
""); "");
String username =
mainPref.getString(RegistrationActivity.this.getResources()
.getString(R.string.username),
"");
osVersion = deviceInfo.getOsVersion();
try { try {
jsObject.put("device", deviceInfo.getDevice()); jsObject.put("deviceIdentifier", deviceInfo.getMACAddress());
jsObject.put("imei", deviceInfo.getDeviceId()); jsObject.put("description", deviceInfo.getDevice());
jsObject.put("imsi", deviceInfo.getIMSINumber()); jsObject.put("ownership", type);
jsObject.put("model", deviceInfo.getDeviceModel()); JSONArray propertiesArray=new JSONArray();
JSONObject property= new JSONObject();
Map<String, String> requestParams = new HashMap<String, String>(); property.put("name", "username");
requestParams.put("regid", regId); property.put("value", username);
requestParams.put("properties", jsObject.toString()); propertiesArray.put(property);
requestParams.put("osversion", osVersion); property= new JSONObject();
requestParams.put("username", username); property.put("name", "device");
requestParams.put("platform", "Android"); property.put("value", deviceInfo.getDevice());
requestParams.put("vendor", deviceInfo.getDeviceManufacturer()); propertiesArray.put(property);
requestParams.put("type", type); property= new JSONObject();
requestParams.put("mac", deviceInfo.getMACAddress()); property.put("name", "imei");
property.put("value", deviceInfo.getDeviceId());
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "imsi");
property.put("value", deviceInfo.getIMSINumber());
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "model");
property.put("value", deviceInfo.getDeviceModel());
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "vendor");
property.put("value", deviceInfo.getOsVersion());
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "osVersion");
property.put("value", deviceInfo.getOsVersion());
propertiesArray.put(property);
jsObject.put("properties", propertiesArray);
// Check network connection availability before calling the API. // Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) { if (PhoneState.isNetworkAvailable(context)) {
// Call device registration API. // Call device registration API.
sendDeviceDetails(requestParams); ServerUtils.callSecuredAPI(RegistrationActivity.this,
// ServerUtils.callSecuredAPI(RegistrationActivity.this, CommonUtilities.API_SERVER_URL + CommonUtilities.REGISTER_ENDPOINT,
// CommonUtilities.REGISTER_ENDPOINT, CommonUtilities.POST_METHOD, jsObject,
// CommonUtilities.POST_METHOD, requestParams, RegistrationActivity.this,
// RegistrationActivity.this, CommonUtilities.REGISTER_REQUEST_CODE);
// CommonUtilities.REGISTER_REQUEST_CODE);
} else { } else {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils.showNetworkUnavailableMessage(RegistrationActivity.this); CommonDialogUtils.showNetworkUnavailableMessage(RegistrationActivity.this);
@ -123,83 +139,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
} }
} }
private void sendDeviceDetails(final Map<String, String> requestParams) {
AsyncTask<Void, Void, Map<String, String>> mLicenseTask =
new AsyncTask<Void, Void, Map<String, String>>() {
@Override
protected Map<String, String> doInBackground(Void... params) {
Map<String, String> response;
response =
HTTPConnectorUtils.postData(context,CommonUtilities.SERVER_URL+CommonUtilities.REGISTER_ENDPOINT,requestParams
);
return response;
}
@Override
protected void onPreExecute() {};
@Override
protected void onPostExecute(Map<String, String> result) {
CommonDialogUtils.stopProgressDialog(progressDialog);
manipulateDeviceDetails(result);
}
};
mLicenseTask.execute();
}
private void manipulateDeviceDetails(Map<String, String> result){
CommonDialogUtils.stopProgressDialog(progressDialog);
String responseStatus = "";
if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus.equals(CommonUtilities.REGISTERATION_SUCCESSFUL)) {
Intent intent =
new Intent(RegistrationActivity.this,
AlreadyRegisteredActivity.class);
intent.putExtra(getResources().getString(R.string.intent_extra_fresh_reg_flag),
true);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
Log.e(TAG, "The value of status is : " + responseStatus);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_connection_error),
getResources().getString(R.string.error_internal_server),
getResources().getString(R.string.button_ok),
registrationFailedOKBtnClickListerner);
} else {
Log.e(TAG, "The value of status is : " + responseStatus);
Log.e(TAG, "The responseStatus is : " + responseStatus);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_registration_error),
getResources().getString(R.string.error_for_all_unknown_registration_failures),
getResources().getString(R.string.button_ok),
registrationFailedOKBtnClickListerner);
alertDialog.show();
}
} else {
Log.e(TAG, "The result is null in onReceiveAPIResult(). ");
Log.e(TAG, "The responseStatus is : " + responseStatus);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_registration_error),
getResources().getString(R.string.error_for_all_unknown_registration_failures),
getResources().getString(R.string.button_ok),
registrationFailedOKBtnClickListerner);
alertDialog.show();
}
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
@ -242,7 +181,7 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
if (result != null) { if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY); responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus.equals(CommonUtilities.REGISTERATION_SUCCESSFUL)) { if (responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
Intent intent = Intent intent =
new Intent(RegistrationActivity.this, new Intent(RegistrationActivity.this,
AlreadyRegisteredActivity.class); AlreadyRegisteredActivity.class);
@ -261,8 +200,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
registrationFailedOKBtnClickListerner); registrationFailedOKBtnClickListerner);
alertDialog.show(); alertDialog.show();
} else { } else {
Log.e(TAG, "The value of status is : " + responseStatus);
Log.e(TAG, "The responseStatus is : " + responseStatus);
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_registration_error), getResources().getString(R.string.title_head_registration_error),

@ -1,12 +1,12 @@
/** /**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -30,6 +30,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.wso2.cdm.agent.api.DeviceInfo; import org.wso2.cdm.agent.api.DeviceInfo;
import org.wso2.cdm.agent.services.MessageProcessor;
import org.wso2.cdm.agent.utils.CommonDialogUtils; import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Preference; import org.wso2.cdm.agent.utils.Preference;
@ -73,18 +74,23 @@ public class ServerDetails extends Activity {
tvSeverAddress.setVisibility(View.GONE); tvSeverAddress.setVisibility(View.GONE);
evServerIP.setVisibility(View.GONE); evServerIP.setVisibility(View.GONE);
alertDialog = alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_authorization_failed), getResources().getString(
getResources().getString(compatibility.getDescriptionResourceID()), R.string.error_authorization_failed),
getResources().getString(R.string.button_ok), getResources().getString(
onRootedClickListner); compatibility
.getDescriptionResourceID()),
getResources().getString(
R.string.button_ok),
onRootedClickListner);
} else { } else {
btnStartRegistration.setVisibility(View.VISIBLE); btnStartRegistration.setVisibility(View.VISIBLE);
evServerIP.setVisibility(View.VISIBLE); evServerIP.setVisibility(View.VISIBLE);
String ipSaved = String ipSaved =
Preference.get(context.getApplicationContext(), Preference.get(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_ip)); getResources().getString(R.string.shared_pref_ip));
regId = Preference.get(context.getApplicationContext(), getResources().getString(R.string.shared_pref_regId)); regId = Preference.get(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_regId));
//check if we have the IP saved previously. //check if we have the IP saved previously.
if (ipSaved != null) { if (ipSaved != null) {
@ -94,23 +100,31 @@ public class ServerDetails extends Activity {
} else { } else {
evServerIP.setText(CommonUtilities.SERVER_IP); evServerIP.setText(CommonUtilities.SERVER_IP);
} }
String deviceActive=Preference.get(context, context.getResources().getString(R.string.shared_pref_device_active));
if(deviceActive!=null && deviceActive.equals("1")){
Intent intent = new Intent(ServerDetails.this, AlreadyRegisteredActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
// on click handler for start registration // on click handler for start registration
btnStartRegistration.setOnClickListener(new OnClickListener() { btnStartRegistration.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(ServerDetails.this); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(ServerDetails.this);
StringBuilder messageBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(getResources().getString(R.string.dialog_init_confirmation)); messageBuilder
.append(getResources().getString(R.string.dialog_init_confirmation));
messageBuilder.append(" "); messageBuilder.append(" ");
messageBuilder.append(evServerIP.getText().toString()); messageBuilder.append(evServerIP.getText().toString());
messageBuilder.append(" "); messageBuilder.append(" ");
messageBuilder.append(getResources().getString(R.string.dialog_init_end_general)); messageBuilder
.append(getResources().getString(R.string.dialog_init_end_general));
alertBuilder.setMessage(messageBuilder.toString()) alertBuilder.setMessage(messageBuilder.toString())
.setPositiveButton(getResources().getString(R.string.yes), .setPositiveButton(getResources().getString(R.string.yes),
dialogClickListener) dialogClickListener)
.setNegativeButton(getResources().getString(R.string.no), .setNegativeButton(getResources().getString(R.string.no),
dialogClickListener).show(); dialogClickListener).show();
} }
}); });
@ -120,7 +134,8 @@ public class ServerDetails extends Activity {
switch (which) { switch (which) {
case DialogInterface.BUTTON_POSITIVE: case DialogInterface.BUTTON_POSITIVE:
if (!evServerIP.getText().toString().trim().equals("")) { if (!evServerIP.getText().toString().trim().equals("")) {
CommonUtilities.setServerURL(evServerIP.getText().toString().trim()); CommonUtilities
.setServerURL(evServerIP.getText().toString().trim());
Preference.put(context.getApplicationContext(), Preference.put(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_ip), getResources().getString(R.string.shared_pref_ip),
evServerIP.getText().toString().trim()); evServerIP.getText().toString().trim());
@ -128,7 +143,8 @@ public class ServerDetails extends Activity {
} else { } else {
Toast.makeText(context.getApplicationContext(), Toast.makeText(context.getApplicationContext(),
getResources().getString(R.string.toast_message_enter_server_address), getResources().getString(
R.string.toast_message_enter_server_address),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
} }
break; break;
@ -151,7 +167,7 @@ public class ServerDetails extends Activity {
}; };
/** /**
* This method is called to open AuthenticationActivity. * This method is called to open AuthenticationActivity.
*/ */
private void startAuthenticationActivity() { private void startAuthenticationActivity() {
Intent intent = new Intent(ServerDetails.this, AuthenticationActivity.class); Intent intent = new Intent(ServerDetails.this, AuthenticationActivity.class);
@ -169,190 +185,4 @@ public class ServerDetails extends Activity {
context = null; context = null;
super.onDestroy(); super.onDestroy();
} }
// Old API manager communication code.
//
// Bundle extras = getIntent().getExtras();
//
// if (extras != null) {
// if
// (extras.containsKey(getResources().getString(R.string.intent_extra_from_activity)))
// {
// fromActivity =
// extras.getString(
// getResources().getString(R.string.intent_extra_from_activity));
// }
// }
//
//
// public class ServerDetails extends Activity implements APIResultCallBack,
// TokenCallBack {
// @Override
// public void onBackPressed() {
// Intent i = new Intent();
// i.setAction(Intent.ACTION_MAIN);
// i.addCategory(Intent.CATEGORY_HOME);
// this.startActivity(i);
// super.onBackPressed();
// }
//
// @Override
// public boolean onKeyDown(int keyCode, KeyEvent event) {
// if (keyCode == KeyEvent.KEYCODE_BACK && fromActivity != null &&
// fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName())) {
// Intent i = new Intent();
// i.setAction(Intent.ACTION_MAIN);
// i.addCategory(Intent.CATEGORY_HOME);
// this.startActivity(i);
// this.finish();
// return true;
// } else if (keyCode == KeyEvent.KEYCODE_BACK && fromActivity != null &&
// fromActivity.equals(AuthenticationActivity.class.getSimpleName())) {
// int pid = android.os.Process.myPid();
// android.os.Process.killProcess(pid);
// return true;
// } else if (keyCode == KeyEvent.KEYCODE_BACK) {
// Intent i = new Intent();
// i.setAction(Intent.ACTION_MAIN);
// i.addCategory(Intent.CATEGORY_HOME);
// this.startActivity(i);
// this.finish();
// return true;
// }
// return super.onKeyDown(keyCode, event);
// }
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.settings, menu);
// return true;
// }
//
// public void onReceiveAPIResult(Map<String, String> result, int
// requestCode) {
// String responseStatus = CommonUtilities.EMPTY_STRING;
// if (result != null) {
// responseStatus = result.get(CommonUtilities.STATUS_KEY);
//
// if (responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL) &&
// requestCode == CommonUtilities.IS_REGISTERED_REQUEST_CODE) {
// Intent intent = null;
// if (progressDialog != null) {
// progressDialog.dismiss();
// }
// intent = new Intent(ServerDetails.this, AlreadyRegisteredActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
//
// } else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR))
// {
// Log.e(TAG, "The value of status is null in onAPIAccessRecive()");
//
// String isRegistered =
// CommonUtilities.getPref(context,
// context.getResources()
// .getString(R.string.shared_pref_registered)
// );
// if (isRegistered.equals("1")) {
// Intent intent = null;
// intent = new Intent(ServerDetails.this, AlreadyRegisteredActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
// } else {
// alertDialog =
// CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
// getResources()
// .getString(
// R.string.title_head_connection_error),
// getResources()
// .getString(
// R.string.error_internal_server),
// getResources()
// .getString(
// R.string.button_ok),
// null);
// Log.e("null", alertDialog.getClass().getPackage().toString());
// alertDialog.show();
// }
// // ServerUtils.clearAppData(context);
// } else {
// Log.e(TAG, "The value of status is : " + responseStatus);
// ServerUtils.clearAppData(context);
//
// alertDialog =
// CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
// getResources()
// .getString(
// R.string.title_head_registration_error),
// getResources()
// .getString(
// R.string.error_internal_server),
// getResources()
// .getString(
// R.string.button_ok),
// null);
// alertDialog.show();
// }
// } else {
// Log.e(TAG, "The result is null in onReceiveAPIResult()");
// ServerUtils.clearAppData(context);
//
// alertDialog =
// CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
// getResources().getString(
// R.string.title_head_registration_error),
// getResources().getString(
// R.string.error_for_all_unknown_registration_failures),
// getResources().getString(
// R.string.button_ok),
// null);
// alertDialog.show();
// }
// }
//
// @Override
// public void onReceiveTokenResult(Token token, String status) {
// if (token != null) {
// if (regId != null && !regId.equals("")) {
// // Check registration.
// isRegistered();
//
// progressDialog =
// ProgressDialog.show(ServerDetails.this,
// getResources().getString(R.string.dialog_sender_id),
// getResources().getString(R.string.dialog_please_wait),
// true);
// }
// }
// }
//
// /**
// * Checks whether device is registered or NOT.
// */
// private void isRegistered() {
// Log.e("isReg", "isReg");
// Map<String, String> requestParams = new HashMap<String, String>();
// requestParams.put("regid", regId);
// Log.e("regID", regId);
//
// // Check network connection availability before calling the API.
// if (PhoneState.isNetworkAvailable(context)) {
// // Call isRegistered API.
// ServerUtils.callSecuredAPI(ServerDetails.this,
// CommonUtilities.IS_REGISTERED_ENDPOINT,
// CommonUtilities.POST_METHOD, requestParams,
// ServerDetails.this,
// CommonUtilities.IS_REGISTERED_REQUEST_CODE);
// } else {
// CommonDialogUtils.stopProgressDialog(progressDialog);
// CommonDialogUtils.showNetworkUnavailableMessage(ServerDetails.this);
// }
//
// }
} }

@ -1,3 +1,18 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.proxy; package org.wso2.cdm.agent.proxy;
import java.util.HashMap; import java.util.HashMap;
@ -61,16 +76,16 @@ public class APIController implements TokenCallBack {
protected Map<String, String> doInBackground(APIUtilities... params) { protected Map<String, String> doInBackground(APIUtilities... params) {
APIUtilities apiUtilities = params[0]; APIUtilities apiUtilities = params[0];
Map<String, String> response_params = null; Map<String, String> responseParams = null;
try { try {
String accessToken = token.getAccessToken(); String accessToken = token.getAccessToken();
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); headers.put("Content-Type", "application/json");
headers.put("Accept", "*/*"); headers.put("Accept", "*/*");
headers.put("User-Agent", "Mozilla/5.0 ( compatible ), Android"); headers.put("User-Agent", "Mozilla/5.0 ( compatible ), Android");
headers.put("Authorization", "Bearer " + accessToken); headers.put("Authorization", "Bearer " + accessToken);
response_params = ServerUtilitiesTemp.postData(apiUtilities, headers); responseParams = ServerApiAccess.postData(apiUtilities, headers);
return response_params; return responseParams;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -1,15 +1,39 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.proxy; package org.wso2.cdm.agent.proxy;
import java.util.Map; import java.util.Map;
import org.json.JSONObject;
public class APIUtilities { public class APIUtilities {
private String httpMethod; private String httpMethod;
private String endPoint; private String endPoint;
private Map<String, String> requestParams; private JSONObject requestParams;
public Map<String, String> getRequestParams() { private Map<String, String> requestParamsMap;
public Map<String, String> getRequestParamsMap() {
return requestParamsMap;
}
public void setRequestParamsMap(Map<String, String> requestParams) {
this.requestParamsMap = requestParams;
}
public JSONObject getRequestParams() {
return requestParams; return requestParams;
} }
public void setRequestParams(Map<String, String> requestParams) { public void setRequestParams(JSONObject requestParams) {
this.requestParams = requestParams; this.requestParams = requestParams;
} }
public String getHttpMethod() { public String getHttpMethod() {

@ -60,14 +60,14 @@ public class AccessTokenHandler extends Activity {
APIUtilities apiUtilities = new APIUtilities(); APIUtilities apiUtilities = new APIUtilities();
apiUtilities.setEndPoint(tokenEndPoint); apiUtilities.setEndPoint(tokenEndPoint);
apiUtilities.setHttpMethod("POST"); apiUtilities.setHttpMethod("POST");
apiUtilities.setRequestParams(request_params); apiUtilities.setRequestParamsMap(request_params);
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
String authorizationString = "Basic " + new String(Base64.encodeBase64((clientID + ":" + clientSecret).getBytes())); String authorizationString = "Basic " + new String(Base64.encodeBase64((clientID + ":" + clientSecret).getBytes()));
headers.put("Authorization", authorizationString); headers.put("Authorization", authorizationString);
headers.put("Content-Type", "application/x-www-form-urlencoded"); headers.put("Content-Type", "application/x-www-form-urlencoded");
Map<String, String> response_params = ServerUtilitiesTemp.postData(apiUtilities,headers); Map<String, String> response_params = ServerApiAccess.postDataAPI(apiUtilities,headers);
response = response_params.get("response"); response = response_params.get("response");
responseCode = response_params.get("status"); responseCode = response_params.get("status");
return response; return response;
@ -84,7 +84,7 @@ public class AccessTokenHandler extends Activity {
if (responseCode != null && responseCode.equals("200")) { if (responseCode != null && responseCode.equals("200")) {
JSONObject response = new JSONObject(result); JSONObject response = new JSONObject(result);
Log.d("sdf",response.toString());
try{ try{
accessToken = response.getString("access_token"); accessToken = response.getString("access_token");
refreshToken = response.getString("refresh_token"); refreshToken = response.getString("refresh_token");
@ -99,6 +99,7 @@ public class AccessTokenHandler extends Activity {
Editor editor = mainPref.edit(); Editor editor = mainPref.edit();
editor.putString("access_token", accessToken); editor.putString("access_token", accessToken);
editor.putString("refresh_token",refreshToken); editor.putString("refresh_token",refreshToken);
editor.putString("username", username);
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date date = new Date(); Date date = new Date();
long expiresIN=date.getTime()+(timeToExpireSecond*1000); long expiresIN=date.getTime()+(timeToExpireSecond*1000);

@ -1,3 +1,18 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.proxy; package org.wso2.cdm.agent.proxy;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
@ -52,7 +67,7 @@ public class RefreshTokenHandler {
apiUtilities.setEndPoint(IdentityProxy.getInstance() apiUtilities.setEndPoint(IdentityProxy.getInstance()
.getAccessTokenURL()); .getAccessTokenURL());
apiUtilities.setHttpMethod("POST"); apiUtilities.setHttpMethod("POST");
apiUtilities.setRequestParams(request_params); apiUtilities.setRequestParamsMap(request_params);
Map<String, String> headers = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>();
Log.e("proxy",IdentityProxy.clientID + ":" + IdentityProxy.clientSecret); Log.e("proxy",IdentityProxy.clientID + ":" + IdentityProxy.clientSecret);
@ -60,7 +75,7 @@ public class RefreshTokenHandler {
headers.put("Authorization", authorizationString); headers.put("Authorization", authorizationString);
headers.put("Content-Type", "application/x-www-form-urlencoded"); headers.put("Content-Type", "application/x-www-form-urlencoded");
Map<String, String> response_params = ServerUtilitiesTemp.postData(apiUtilities,headers); Map<String, String> response_params = ServerApiAccess.postDataAPI(apiUtilities,headers);
response = response_params.get("response"); response = response_params.get("response");
responseCode = response_params.get("status"); responseCode = response_params.get("status");

@ -1,14 +1,26 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.proxy; package org.wso2.cdm.agent.proxy;
import android.content.Context;
import android.util.Log; import android.util.Log;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.*; import org.apache.http.*;
import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpPut;
@ -19,11 +31,13 @@ import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams; import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams; import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
import org.json.JSONObject;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
@ -31,6 +45,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.security.KeyStore; import java.security.KeyStore;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -40,7 +55,7 @@ import java.util.Map.Entry;
/** /**
* Handle network communication between SDK and authorization server * Handle network communication between SDK and authorization server
*/ */
public class ServerUtilitiesTemp { public class ServerApiAccess {
private final static String TAG = "ServerUtilities"; private final static String TAG = "ServerUtilities";
private static boolean isSSLEnable = false; private static boolean isSSLEnable = false;
private static InputStream inputStream; private static InputStream inputStream;
@ -84,91 +99,93 @@ public class ServerUtilitiesTemp {
public static Map<String, String> postData(APIUtilities apiUtilities, Map<String, String> headers) { public static Map<String, String> postData(APIUtilities apiUtilities, Map<String, String> headers) {
String httpMethod = apiUtilities.getHttpMethod(); String httpMethod = apiUtilities.getHttpMethod();
String url = apiUtilities.getEndPoint(); String url = apiUtilities.getEndPoint();
Map<String, String> params = apiUtilities.getRequestParams(); JSONObject params = apiUtilities.getRequestParams();
Map<String, String> responseParams = new HashMap<String, String>();
Map<String, String> response_params = new HashMap<String, String>();
HttpClient httpclient = getCertifiedHttpClient(); HttpClient httpclient = getCertifiedHttpClient();
String payload = buildPayload(params);
if(httpMethod.equals("POST")){ if(httpMethod.equals("POST")){
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
if(params!=null){
try {
httpPost.setEntity(new StringEntity(params.toString()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}else{
httpPost.setEntity(null);
}
Log.e("url",""+url); Log.e("url",""+url);
HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod); HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod);
byte[] postData = payload.getBytes();
try { try {
httpPostWithHeaders.setEntity(new ByteArrayEntity(postData));
HttpResponse response = httpclient.execute(httpPostWithHeaders); HttpResponse response = httpclient.execute(httpPostWithHeaders);
String status = String.valueOf(response.getStatusLine().getStatusCode()); String status = String.valueOf(response.getStatusLine().getStatusCode());
Log.d(TAG,status); Log.d(TAG,status);
response_params.put("response", getResponseBody(response)); responseParams.put("response", getResponseBody(response));
response_params.put("status", status); responseParams.put("status", status);
return response_params; return responseParams;
} catch (ClientProtocolException e) { } catch (ClientProtocolException e) {
Log.d(TAG, "ClientProtocolException :"+e.toString()); Log.d(TAG, "ClientProtocolException :"+e.toString());
return null; return null;
} catch (IOException e) { } catch (IOException e) {
Log.d(TAG, e.toString()); Log.d(TAG, e.toString());
response_params.put("response", "Internal Server Error"); responseParams.put("response", "Internal Server Error");
response_params.put("status", "500"); responseParams.put("status", "500");
return response_params; return responseParams;
} }
}else if(httpMethod.equals("PUT")){ }
HttpPut httpPut = new HttpPut(url); else if(httpMethod.equals("GET")){
HttpPut httpPutWithHeaders = (HttpPut)buildHeaders(httpPut,headers,httpMethod); // if(payload!=null){
byte[] putData = payload.getBytes(); // url = url+"?"+payload;
try { // }
httpPutWithHeaders.setEntity(new ByteArrayEntity(putData));
HttpResponse response = httpclient.execute(httpPutWithHeaders);
response_params.put("response", getResponseBody(response));
response_params.put("status", String.valueOf(response.getStatusLine().getStatusCode()));
return response_params;
} catch (ClientProtocolException e) {
Log.d(TAG, "ClientProtocolException :"+e.toString());
return null;
} catch (IOException e) {
Log.d(TAG, e.toString());
response_params.put("response", "Internal Server Error");
response_params.put("status", "500");
return response_params;
}
}else if(httpMethod.equals("GET")){
if(payload!=null){
url = url+"?"+payload;
}
HttpGet httpGet = new HttpGet(url); HttpGet httpGet = new HttpGet(url);
HttpGet httpGetWithHeaders = (HttpGet) buildHeaders(httpGet,headers,httpMethod); HttpGet httpGetWithHeaders = (HttpGet) buildHeaders(httpGet,headers,httpMethod);
Log.d(TAG,httpGetWithHeaders.toString()); Log.d(TAG,httpGetWithHeaders.toString()+" GET");
try { try {
HttpResponse response = httpclient.execute(httpGetWithHeaders); HttpResponse response = httpclient.execute(httpGetWithHeaders);
response_params.put("response", getResponseBody(response)); responseParams.put("response", getResponseBody(response));
response_params.put("status", String.valueOf(response.getStatusLine().getStatusCode())); responseParams.put("status", String.valueOf(response.getStatusLine().getStatusCode()));
return response_params; return responseParams;
} catch (ClientProtocolException e) { } catch (ClientProtocolException e) {
Log.d(TAG, "ClientProtocolException :"+e.toString()); Log.d(TAG, "ClientProtocolException :"+e.toString());
return null; return null;
} catch (IOException e) { } catch (IOException e) {
Log.d(TAG, e.toString()); Log.d(TAG, e.toString());
response_params.put("response", "Internal Server Error"); responseParams.put("response", "Internal Server Error");
response_params.put("status", "500"); responseParams.put("status", "500");
return response_params; return responseParams;
} }
}else if(httpMethod.equals("Delete")){ }
if(payload!=null){ return null;
url = url+"?"+payload; }
}
HttpDelete httpDelete = new HttpDelete(url); public static Map<String, String> postDataAPI(APIUtilities apiUtilities, Map<String, String> headers) {
HttpDelete httpDeleteWithHeaders = (HttpDelete) buildHeaders(httpDelete,headers,httpMethod); String httpMethod = apiUtilities.getHttpMethod();
Log.d(TAG,httpDeleteWithHeaders.toString()); String url = apiUtilities.getEndPoint();
Map<String, String> params = apiUtilities.getRequestParamsMap();
Map<String, String> response_params = new HashMap<String, String>();
HttpClient httpclient = getCertifiedHttpClient();
String payload = buildPayload(params);
if(httpMethod.equals("POST")){
HttpPost httpPost = new HttpPost(url);
Log.e("url",""+url);
HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod);
byte[] postData = payload.getBytes();
try { try {
HttpResponse response = httpclient.execute(httpDeleteWithHeaders); httpPostWithHeaders.setEntity(new ByteArrayEntity(postData));
HttpResponse response = httpclient.execute(httpPostWithHeaders);
String status = String.valueOf(response.getStatusLine().getStatusCode());
Log.d(TAG,status);
response_params.put("response", getResponseBody(response)); response_params.put("response", getResponseBody(response));
response_params.put("status", String.valueOf(response.getStatusLine().getStatusCode())); response_params.put("status", status);
return response_params; return response_params;
} catch (ClientProtocolException e) { } catch (ClientProtocolException e) {
Log.d(TAG, "ClientProtocolException :"+e.toString()); Log.d(TAG, "ClientProtocolException :"+e.toString());
return null; return null;
} catch (IOException e) { } catch (IOException e) {
Log.d(TAG, e.toString()); Log.d(TAG, e.toString());
response_params.put("response", "Internal Server Error"); response_params.put("response", "Internal Server Error");
response_params.put("status", "500"); response_params.put("status", "500");
return response_params; return response_params;
@ -215,7 +232,7 @@ public class ServerUtilitiesTemp {
HttpEntity entity = null; HttpEntity entity = null;
try { try {
entity = response.getEntity(); entity = response.getEntity();
response_text = _getResponseBody(entity); response_text = getResponseBodyContent(entity);
} catch (ParseException e) { } catch (ParseException e) {
Log.d(TAG, e.toString()); Log.d(TAG, e.toString());
} catch (IOException e) { } catch (IOException e) {
@ -230,7 +247,7 @@ public class ServerUtilitiesTemp {
return response_text; return response_text;
} }
public static String _getResponseBody(final HttpEntity entity) throws IOException, ParseException { public static String getResponseBodyContent(final HttpEntity entity) throws IOException, ParseException {
if (entity == null) { if (entity == null) {
throw new IllegalArgumentException("HTTP entity may not be null"); throw new IllegalArgumentException("HTTP entity may not be null");

@ -1,24 +1,23 @@
/* /**
~ Copyright (c) 2014, WSO2 Inc. (http://wso2.com/) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ *
~ Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at * You may obtain a copy of the License at
~ *
~ http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
~ limitations under the License. * limitations under the License.
*/ */
package org.wso2.cdm.agent.services; package org.wso2.cdm.agent.services;
import java.util.Map;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Constant;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -27,19 +26,16 @@ import android.util.Log;
public class AlarmReceiver extends BroadcastReceiver { public class AlarmReceiver extends BroadcastReceiver {
private static final String DEBUG_TAG = "AlarmReceiver"; private static final String DEBUG_TAG = "AlarmReceiver";
Map<String, String> server_res = null;
Context context;
ProcessMessage processMsg = null;
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d(DEBUG_TAG, "Recurring alarm; requesting download service."); Log.d(DEBUG_TAG, "Recurring alarm; requesting download service.");
this.context = context;
String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode)); String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode));
if(mode.trim().toUpperCase().equals("LOCAL")){ //if(mode.trim().toUpperCase().equals(Constant.LOCAL)){
ProcessMessage msg=new ProcessMessage(context); MessageProcessor messageProcessor=new MessageProcessor(context);
msg.getOperations(null); messageProcessor.getMessages();
} //}
} }
} }

@ -26,20 +26,22 @@ import android.os.SystemClock;
* polls to server based on a predefined to retrieve pending data. * polls to server based on a predefined to retrieve pending data.
*/ */
public class LocalNotification { public class LocalNotification {
public static boolean localNoticicationInvoked=false;
public static void startPolling(Context context) { public static void startPolling(Context context) {
int interval=10000; int interval=10000;
// int interval=Preference.getInt(context, context.getResources().getString(R.string.shared_pref_interval));
//TODO:remove hard coded value
long firstTime = SystemClock.elapsedRealtime(); long firstTime = SystemClock.elapsedRealtime();
firstTime += 1000; firstTime += 1000;
if(localNoticicationInvoked==false){
Intent downloader = new Intent(context, AlarmReceiver.class); localNoticicationInvoked=true;
PendingIntent recurringDownload = PendingIntent.getBroadcast(context, Intent downloader = new Intent(context, AlarmReceiver.class);
0, downloader, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent recurringDownload = PendingIntent.getBroadcast(context,
AlarmManager alarms = (AlarmManager) context 0, downloader, PendingIntent.FLAG_CANCEL_CURRENT);
.getSystemService(Context.ALARM_SERVICE); AlarmManager alarms = (AlarmManager) context
alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, .getSystemService(Context.ALARM_SERVICE);
interval, recurringDownload); alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime,
interval, recurringDownload);
}
} }
} }

@ -0,0 +1,127 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.services;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.RegistrationActivity;
import org.wso2.cdm.agent.api.DeviceInfo;
import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Constant;
import org.wso2.cdm.agent.utils.Preference;
import org.wso2.cdm.agent.utils.ServerUtils;
import android.content.Context;
import android.util.Log;
/**
* Used to coordinate the retrieval and processing of messages from the server.
*/
public class MessageProcessor implements APIResultCallBack {
private String TAG = MessageProcessor.class.getSimpleName();
private Context context;
String deviceId;
/**
* Local notification message handler.
*
* @param context
* Context of the application.
*/
public MessageProcessor(Context context) {
this.context = context;
deviceId=Preference.get(context, "deviceId");
if(deviceId ==null){
DeviceInfo deviceInfo = new DeviceInfo(context);
deviceId=deviceInfo.getMACAddress();
Preference.put(context, "deviceId", deviceId);
}
}
/**
* @param response
* Response received from the server that needs to be processed
* and applied to the device
*/
public void performOperation(String response) {
try {
JSONArray operations = new JSONArray(response);
for (int x = 0; x < operations.length(); x++) {
String featureCode = operations.getJSONObject(x).getString(Constant.CODE);
String properties = operations.getJSONObject(x).getString(Constant.PROPERTIES);
Operation operation = new Operation(context);
operation.doTask(featureCode, properties, 0);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
/**
* Call the message retrieval end point of the server to get messages
* pending.
*/
public void getMessages() {
String ipSaved =
Preference.get(context.getApplicationContext(),
context.getResources().getString(R.string.shared_pref_ip));
CommonUtilities.setServerURL(ipSaved);
String deviceIdentifier = "";
try {
deviceIdentifier = URLEncoder.encode(deviceId, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ServerUtils.callSecuredAPI(context, CommonUtilities.API_SERVER_URL +
CommonUtilities.NOTIFICATION_ENDPOINT+File.separator+deviceIdentifier,
CommonUtilities.GET_METHOD, new JSONObject(), MessageProcessor.this,
CommonUtilities.NOTIFICATION_REQUEST_CODE);
}
@Override
public void onReceiveAPIResult(Map<String, String> result, int requestCode) {
String responseStatus;
String response;
if (requestCode == CommonUtilities.NOTIFICATION_REQUEST_CODE) {
if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus != null &&
responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
response = result.get(Constant.RESPONSE);
if (response != null && !response.equals("")) {
if (CommonUtilities.DEBUG_MODE_ENABLED) {
Log.e(TAG, "onReceiveAPIResult- " + response);
}
performOperation(response);
}
}
}
}
}
}

@ -402,11 +402,11 @@ public class Operation {
@SuppressWarnings("static-access") @SuppressWarnings("static-access")
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public JSONArray doTask(String code_in, String data_in, int req_mode) { public JSONArray doTask(String codeIn, String dataIn, int req_mode) {
Log.e("doTask","code:"+code_in+"\n"+data_in); Log.e("doTask","code:"+codeIn+"\n"+dataIn);
String data_input=data_in; String dataInput=dataIn;
String code_input = code_in; String codeInput = codeIn;
String notification = ""; String notification = "";
String ssid = ""; String ssid = "";
String password = ""; String password = "";
@ -421,7 +421,7 @@ public class Operation {
JSONArray resultArr= new JSONArray(); JSONArray resultArr= new JSONArray();
JSONObject result= new JSONObject(); JSONObject result= new JSONObject();
if (code_input.equals(CommonUtilities.OPERATION_DEVICE_INFO)) { if (codeInput.equals(CommonUtilities.OPERATION_DEVICE_INFO)) {
PhoneState phoneState = new PhoneState(context); PhoneState phoneState = new PhoneState(context);
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
@ -459,7 +459,7 @@ public class Operation {
obj.put("operator", deviceInfo.getNetworkOperatorName()); obj.put("operator", deviceInfo.getNetworkOperatorName());
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
params.put("data", obj.toString()); params.put("data", obj.toString());
@ -467,7 +467,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", obj); result.put("data", obj);
Map<String, String> as = new HashMap<String, String>(); Map<String, String> as = new HashMap<String, String>();
@ -500,7 +500,7 @@ public class Operation {
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_DEVICE_LOCATION)) { } else if (codeInput.equals(CommonUtilities.OPERATION_DEVICE_LOCATION)) {
LocationServices ls = new LocationServices(context); LocationServices ls = new LocationServices(context);
Log.v("Latitude", ls.getLatitude()); Log.v("Latitude", ls.getLatitude());
@ -520,10 +520,10 @@ public class Operation {
params.put("data", obj.toString()); params.put("data", obj.toString());
//for local notification\ //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", obj); result.put("data", obj);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -540,7 +540,7 @@ public class Operation {
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input } else if (codeInput
.equals(CommonUtilities.OPERATION_GET_APPLICATION_LIST)) { .equals(CommonUtilities.OPERATION_GET_APPLICATION_LIST)) {
ArrayList<PInfo> apps = appList.getInstalledApps(false); /* ArrayList<PInfo> apps = appList.getInstalledApps(false); /*
* false = * false =
@ -572,7 +572,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", jsonArray); result.put("data", jsonArray);
@ -588,7 +588,7 @@ public class Operation {
params.put("status", "200"); params.put("status", "200");
//params.put("data", Uri.encode(jsonArray.toString())); //params.put("data", Uri.encode(jsonArray.toString()));
Log.e("PASSING MSG ID : ",token); Log.e("PASSING MSG ID : ",token);
Log.e("PASSING CODE : ",code_input); Log.e("PASSING CODE : ",codeInput);
@ -604,19 +604,19 @@ public class Operation {
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_LOCK_DEVICE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_LOCK_DEVICE)) {
Log.d(TAG, "Locking device now"); Log.d(TAG, "Locking device now");
try { try {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) { if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -639,7 +639,7 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_WIPE_DATA)) { } else if (codeInput.equals(CommonUtilities.OPERATION_WIPE_DATA)) {
Log.d(TAG, Log.d(TAG,
@ -650,10 +650,10 @@ public class Operation {
String pinSaved = mainPref.getString("pin", ""); String pinSaved = mainPref.getString("pin", "");
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
pin = (String) jobj.get("pin"); pin = (String) jobj.get("pin");
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
@ -670,7 +670,7 @@ public class Operation {
} }
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context); //ServerUtilities.pushData(params, context);
@ -703,20 +703,20 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_CLEAR_PASSWORD)) { } else if (codeInput.equals(CommonUtilities.OPERATION_CLEAR_PASSWORD)) {
ComponentName demoDeviceAdmin = new ComponentName(context, ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
try { try {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) { if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -745,11 +745,11 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_NOTIFICATION)) { } else if (codeInput.equals(CommonUtilities.OPERATION_NOTIFICATION)) {
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (jobj.get("notification").toString() != null if (jobj.get("notification").toString() != null
|| jobj.get("notification").toString().equals("")) { || jobj.get("notification").toString().equals("")) {
notification = jobj.get("notification").toString(); notification = jobj.get("notification").toString();
@ -762,14 +762,14 @@ public class Operation {
Log.v("Notification", notification); Log.v("Notification", notification);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context); //ServerUtilities.pushData(params, context);
@ -787,12 +787,12 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_WIFI)) { } else if (codeInput.equals(CommonUtilities.OPERATION_WIFI)) {
boolean wifistatus = false; boolean wifistatus = false;
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("ssid")) { if (!jobj.isNull("ssid")) {
ssid = (String) jobj.get("ssid"); ssid = (String) jobj.get("ssid");
} }
@ -804,7 +804,7 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
Map<String, String> inparams = new HashMap<String, String>(); Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
WiFiConfig config = new WiFiConfig(context); WiFiConfig config = new WiFiConfig(context);
@ -812,7 +812,7 @@ public class Operation {
try { try {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("code", code_input); result.put("code", codeInput);
wifistatus = config.saveWEPConfig(ssid, password); wifistatus = config.saveWEPConfig(ssid, password);
if (wifistatus) { if (wifistatus) {
@ -841,12 +841,12 @@ public class Operation {
} }
} }
} else if (code_input.equals(CommonUtilities.OPERATION_DISABLE_CAMERA)) { } else if (codeInput.equals(CommonUtilities.OPERATION_DISABLE_CAMERA)) {
boolean camFunc = false; boolean camFunc = false;
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("function") if (!jobj.isNull("function")
&& jobj.get("function").toString() && jobj.get("function").toString()
.equalsIgnoreCase("enable")) { .equalsIgnoreCase("enable")) {
@ -863,14 +863,14 @@ public class Operation {
ComponentName cameraAdmin = new ComponentName(context, ComponentName cameraAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
String cammode = "Disabled"; String cammode = "Disabled";
@ -904,29 +904,29 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input } else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION) .equals(CommonUtilities.OPERATION_INSTALL_APPLICATION)
|| code_input || codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) { .equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) {
try { try {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (code_input if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION)) { .equals(CommonUtilities.OPERATION_INSTALL_APPLICATION)) {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
installApplication(jobj, code_input); installApplication(jobj, codeInput);
} else if (code_input } else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) { .equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) {
JSONArray jArray = null; JSONArray jArray = null;
jArray = new JSONArray(data_input); jArray = new JSONArray(dataInput);
for (int i = 0; i < jArray.length(); i++) { for (int i = 0; i < jArray.length(); i++) {
JSONObject appObj = (JSONObject) jArray JSONObject appObj = (JSONObject) jArray
.getJSONObject(i); .getJSONObject(i);
installApplication(appObj, code_input); installApplication(appObj, codeInput);
} }
} }
@ -935,18 +935,18 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input } else if (codeInput
.equals(CommonUtilities.OPERATION_UNINSTALL_APPLICATION)) { .equals(CommonUtilities.OPERATION_UNINSTALL_APPLICATION)) {
String packageName = ""; String packageName = "";
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
packageName = (String) jobj.get("identity"); packageName = (String) jobj.get("identity");
Log.v("Package Name : ", packageName); Log.v("Package Name : ", packageName);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
@ -954,7 +954,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context); //ServerUtilities.pushData(params, context);
@ -968,13 +968,13 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_ENCRYPT_STORAGE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_ENCRYPT_STORAGE)) {
boolean encryptFunc = true; boolean encryptFunc = true;
String pass = ""; String pass = "";
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("function") if (!jobj.isNull("function")
&& jobj.get("function").toString() && jobj.get("function").toString()
.equalsIgnoreCase("encrypt")) { .equalsIgnoreCase("encrypt")) {
@ -991,7 +991,7 @@ public class Operation {
ComponentName admin = new ComponentName(context, ComponentName admin = new ComponentName(context,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
if (encryptFunc if (encryptFunc
@ -1020,7 +1020,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (devicePolicyManager.getStorageEncryptionStatus() != devicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) { if (devicePolicyManager.getStorageEncryptionStatus() != devicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) {
params.put("status", "200"); params.put("status", "200");
result.put("status", "true"); result.put("status", "true");
@ -1045,19 +1045,19 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_MUTE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_MUTE)) {
Log.d(TAG, "Muting Device"); Log.d(TAG, "Muting Device");
try { try {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) { if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1079,7 +1079,7 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_TRACK_CALLS)) { } else if (codeInput.equals(CommonUtilities.OPERATION_TRACK_CALLS)) {
try { try {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
@ -1091,7 +1091,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", new JSONObject(conversations.getCallDetails().toString())); result.put("data", new JSONObject(conversations.getCallDetails().toString()));
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1104,7 +1104,7 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_TRACK_SMS)) { } else if (codeInput.equals(CommonUtilities.OPERATION_TRACK_SMS)) {
int MESSAGE_TYPE_INBOX = 1; int MESSAGE_TYPE_INBOX = 1;
int MESSAGE_TYPE_SENT = 2; int MESSAGE_TYPE_SENT = 2;
JSONObject smsObj = new JSONObject(); JSONObject smsObj = new JSONObject();
@ -1123,7 +1123,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", smsObj); result.put("data", smsObj);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1136,7 +1136,7 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_DATA_USAGE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_DATA_USAGE)) {
JSONObject dataObj = new JSONObject(); JSONObject dataObj = new JSONObject();
try { try {
@ -1152,7 +1152,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", new JSONObject(deviceState.takeDataUsageSnapShot() result.put("data", new JSONObject(deviceState.takeDataUsageSnapShot()
.toString())); .toString()));
@ -1166,7 +1166,7 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_STATUS)) { } else if (codeInput.equals(CommonUtilities.OPERATION_STATUS)) {
boolean encryptStatus = false; boolean encryptStatus = false;
boolean passCodeStatus = false; boolean passCodeStatus = false;
try { try {
@ -1195,7 +1195,7 @@ public class Operation {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
params.put("data", dataObj.toString()); params.put("data", dataObj.toString());
@ -1203,7 +1203,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", dataObj); result.put("data", dataObj);
if (req_mode == REQUEST_MODE_NORMAL) { if (req_mode == REQUEST_MODE_NORMAL) {
@ -1224,26 +1224,26 @@ public class Operation {
e1.printStackTrace(); e1.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_WEBCLIP)) { } else if (codeInput.equals(CommonUtilities.OPERATION_WEBCLIP)) {
String appUrl = ""; String appUrl = "";
String title = ""; String title = "";
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
Log.v("WEBCLIP DATA : ", data.toString()); Log.v("WEBCLIP DATA : ", data.toString());
appUrl = (String) jobj.get("identity"); appUrl = (String) jobj.get("identity");
title = (String) jobj.get("title"); title = (String) jobj.get("title");
Log.v("Web App URL : ", appUrl); Log.v("Web App URL : ", appUrl);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context); //ServerUtilities.pushData(params, context);
@ -1256,7 +1256,7 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_PASSWORD_POLICY)) { } else if (codeInput.equals(CommonUtilities.OPERATION_PASSWORD_POLICY)) {
ComponentName demoDeviceAdmin = new ComponentName(context, ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
@ -1273,8 +1273,8 @@ public class Operation {
try { try {
result.put("code", code_input); result.put("code", codeInput);
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("maxFailedAttempts") if (!jobj.isNull("maxFailedAttempts")
&& jobj.get("maxFailedAttempts") != null) { && jobj.get("maxFailedAttempts") != null) {
attempts = Integer.parseInt((String) jobj attempts = Integer.parseInt((String) jobj
@ -1356,7 +1356,7 @@ public class Operation {
String policy = mainPref.getString("policy", ""); String policy = mainPref.getString("policy", "");
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
inparams.put("status", "200"); inparams.put("status", "200");
result.put("status", "true"); result.put("status", "true");
@ -1393,7 +1393,7 @@ public class Operation {
} }
} }
} else if (code_input.equals(CommonUtilities.OPERATION_EMAIL_CONFIGURATION)) { } else if (codeInput.equals(CommonUtilities.OPERATION_EMAIL_CONFIGURATION)) {
String emailname="", emailtype="", ic_username="", ic_password="", ic_hostname=""; String emailname="", emailtype="", ic_username="", ic_password="", ic_hostname="";
long timout; long timout;
Map<String, String> inparams = new HashMap<String, String>(); Map<String, String> inparams = new HashMap<String, String>();
@ -1404,8 +1404,8 @@ public class Operation {
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
result.put("code", code_input); result.put("code", codeInput);
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("type") if (!jobj.isNull("type")
&& jobj.get("type") != null) { && jobj.get("type") != null) {
emailtype = (String) jobj emailtype = (String) jobj
@ -1438,7 +1438,7 @@ public class Operation {
ic_hostname = ""; ic_hostname = "";
} }
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
inparams.put("status", "200"); inparams.put("status", "200");
result.put("status", "true"); result.put("status", "true");
@ -1475,25 +1475,25 @@ public class Operation {
} }
} }
}else if (code_input }else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_GOOGLE_APP)) { .equals(CommonUtilities.OPERATION_INSTALL_GOOGLE_APP)) {
String packageName = ""; String packageName = "";
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
packageName = (String) jobj.get("package"); packageName = (String) jobj.get("package");
Log.v("Package Name : ", packageName); Log.v("Package Name : ", packageName);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input); params.put("code", codeInput);
params.put("msgID", token); params.put("msgID", token);
params.put("status", "200"); params.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context); //ServerUtilities.pushData(params, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) { } else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1509,7 +1509,7 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input } else if (codeInput
.equals(CommonUtilities.OPERATION_CHANGE_LOCK_CODE)) { .equals(CommonUtilities.OPERATION_CHANGE_LOCK_CODE)) {
ComponentName demoDeviceAdmin = new ComponentName(context, ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class); WSO2DeviceAdminReceiver.class);
@ -1519,19 +1519,19 @@ public class Operation {
JSONParser jp = new JSONParser(); JSONParser jp = new JSONParser();
try { try {
JSONObject jobj = new JSONObject(data_input); JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("password")) { if (!jobj.isNull("password")) {
pass = (String) jobj.get("password"); pass = (String) jobj.get("password");
} }
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
inparams.put("status", "200"); inparams.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(inparams, context); //ServerUtilities.pushData(inparams, context);
@ -1570,7 +1570,7 @@ public class Operation {
} }
} }
} else if (code_input.equals(CommonUtilities.OPERATION_POLICY_BUNDLE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_POLICY_BUNDLE)) {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
try { try {
params.put("code", code); params.put("code", code);
@ -1581,7 +1581,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", new JSONObject(bundle_params.toString())); result.put("data", new JSONObject(bundle_params.toString()));
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1593,7 +1593,7 @@ public class Operation {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_POLICY_MONITOR)) { } else if (codeInput.equals(CommonUtilities.OPERATION_POLICY_MONITOR)) {
JSONArray sendjArray; JSONArray sendjArray;
JSONObject jobj=null; JSONObject jobj=null;
try { try {
@ -1610,7 +1610,7 @@ public class Operation {
} }
Log.e("PASSING MSG ID : ",policy_token); Log.e("PASSING MSG ID : ",policy_token);
Log.e("PASSING CODE : ",code_input); Log.e("PASSING CODE : ",codeInput);
Log.e("PASSING TYPE : ",String.valueOf(type)); Log.e("PASSING TYPE : ",String.valueOf(type));
PolicyTester tester = new PolicyTester(context, sendjArray, PolicyTester tester = new PolicyTester(context, sendjArray,
type, policy_token); type, policy_token);
@ -1620,19 +1620,19 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} else if (code_input.equals(CommonUtilities.OPERATION_POLICY_REVOKE)) { } else if (codeInput.equals(CommonUtilities.OPERATION_POLICY_REVOKE)) {
try { try {
Map<String, String> inparams = new HashMap<String, String>(); Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
inparams.put("status", "200"); inparams.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(inparams, context); //ServerUtilities.pushData(inparams, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) { } else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1644,19 +1644,19 @@ public class Operation {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
}else if (code_input.equals(CommonUtilities.OPERATION_ENTERPRISE_WIPE_DATA)) { }else if (codeInput.equals(CommonUtilities.OPERATION_ENTERPRISE_WIPE_DATA)) {
try { try {
Map<String, String> inparams = new HashMap<String, String>(); Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input); inparams.put("code", codeInput);
inparams.put("msgID", token); inparams.put("msgID", token);
inparams.put("status", "200"); inparams.put("status", "200");
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(inparams, context); //ServerUtilities.pushData(inparams, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) { } else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1674,7 +1674,7 @@ public class Operation {
e.printStackTrace(); e.printStackTrace();
} }
} }
else if (code_input else if (codeInput
.equals(CommonUtilities.OPERATION_BLACKLIST_APPS)) { .equals(CommonUtilities.OPERATION_BLACKLIST_APPS)) {
ArrayList<PInfo> apps = appList.getInstalledApps(false); /* ArrayList<PInfo> apps = appList.getInstalledApps(false); /*
* false = * false =
@ -1692,7 +1692,7 @@ public class Operation {
try{ try{
JSONObject appsObj = new JSONObject(data_input); JSONObject appsObj = new JSONObject(dataInput);
if (!appsObj.isNull("data")) { if (!appsObj.isNull("data")) {
appsObj = (JSONObject) appsObj.get("data"); appsObj = (JSONObject) appsObj.get("data");
} }
@ -1737,7 +1737,7 @@ public class Operation {
//for local notification //for local notification
resultArr.put(result); resultArr.put(result);
result.put("status", "true"); result.put("status", "true");
result.put("code", code_input); result.put("code", codeInput);
result.put("data", jsonArray); result.put("data", jsonArray);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) { if (mode == CommonUtilities.MESSAGE_MODE_GCM) {

@ -1,249 +0,0 @@
/*
~ Copyright (c) 2014, WSO2 Inc. (http://wso2.com/) All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
*/
package org.wso2.cdm.agent.services;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.simple.parser.JSONParser;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.parser.PayloadParser;
import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.LoggerCustom;
import org.wso2.cdm.agent.utils.ServerUtils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.util.Log;
public class ProcessMessage implements APIResultCallBack{
private String TAG = ProcessMessage.class.getSimpleName();
Operation operation;
Map<String, String> params;
AsyncTask<Void, Void, String> sendReply;
Map<String, String> responsePayload;
Context context;
String replyPayload;
public static boolean stillProcessing=false;
AlertDialog.Builder alertDialog;
public ProcessMessage(Context context, int mode, String message, String recepient) {
// TODO Auto-generated constructor stub
JSONParser jp = new JSONParser();
params = new HashMap<String, String>();
try {
JSONObject jobj = new JSONObject(message);
params.put("code", (String)jobj.get("message"));
if(jobj.has("data")){
params.put("data", ((JSONObject)jobj.get("data")).toString());
}
operation = new Operation(context, mode, params, recepient);
} catch (Exception e) {
e.printStackTrace();
}
}
// local notification message handler
public ProcessMessage(Context context) {
this.context = context;
}
public void getOperations(String replyData) {
String isRegistered=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_registered));
if(isRegistered.equals("1")){
if(stillProcessing==false){
String isActive = CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_device_active));
if (isActive.equals("1")) {
try {
SharedPreferences mainPref =
context.getSharedPreferences(context.getResources()
.getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
String regId =
mainPref.getString(context.getResources()
.getString(R.string.shared_pref_regId), "");
Map<String, String> requestParams = new HashMap<String, String>();
if (replyData != null) {
requestParams.put("data", replyPayload);
}
requestParams.put("regId", regId);
ServerUtils.callSecuredAPI(context,
CommonUtilities.NOTIFICATION_ENDPOINT,
CommonUtilities.POST_METHOD, requestParams,
ProcessMessage.this,
CommonUtilities.NOTIFICATION_REQUEST_CODE);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
@Override
public void onReceiveAPIResult(Map<String, String> result, int requestCode) {
String responseStatus = "";
String response = "";
if (requestCode == CommonUtilities.NOTIFICATION_REQUEST_CODE) {
if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus != null) {
if (responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
response = result.get("response");
//processMsg = new ProcessMessage(context, CommonUtilities.MESSAGE_MODE_LOCAL, response);
if(response!=null && !response.equals("") && !response.equals("null")){
if(CommonUtilities.DEBUG_MODE_ENABLED){
Log.e(TAG, "onReceiveAPIResult- "+response);
}
messageExecute(response);
}
}
}
}
}
}
private void messageExecute(String msg) {
stillProcessing=true;
JSONArray repArray =new JSONArray();
JSONObject jsReply=null;
String msgId="";
JSONArray dataReply=null;
try {
JSONArray jArr=new JSONArray(msg.trim());
for(int i=0;i<jArr.length();i++){
JSONArray innerArr=new JSONArray(jArr.getJSONObject(i).getString("data"));
String featureCode=jArr.getJSONObject(i).getString("code");
dataReply=new JSONArray();
jsReply=new JSONObject();
jsReply.put("code",featureCode);
for(int x=0;x<innerArr.length();x++){
msgId=innerArr.getJSONObject(x).getString("messageId");
jsReply.put("messageId", msgId);
if (featureCode.equals(CommonUtilities.OPERATION_POLICY_BUNDLE)) {
SharedPreferences mainPrefp =
context.getSharedPreferences("com.mdm",
Context.MODE_PRIVATE);
Editor editorp = mainPrefp.edit();
editorp.putString("policy", "");
editorp.commit();
SharedPreferences mainPref =
context.getSharedPreferences("com.mdm",
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
String arrToPut=innerArr.getJSONObject(0).getJSONArray("data").toString();
editor.putString("policy", arrToPut);
editor.commit();
}
String msgData=innerArr.getJSONObject(x).getString("data");
JSONObject dataObj=new JSONObject("{}");
operation = new Operation(context);
if(featureCode.equalsIgnoreCase(CommonUtilities.OPERATION_POLICY_REVOKE)){
operation.operate(featureCode,jsReply);
jsReply.put("status", msgId);
}else{
if(msgData.charAt(0)=='['){
JSONArray dataArr=new JSONArray(msgData);
for(int a=0;a<dataArr.length();a++){
JSONObject innterDataObj=dataArr.getJSONObject(a);
featureCode=innterDataObj.getString("code");
String dataTemp=innterDataObj.getString("data");
if(!dataTemp.isEmpty() && dataTemp!=null && !dataTemp.equalsIgnoreCase("null"))
dataObj =innterDataObj.getJSONObject("data");
dataReply= operation.operate(featureCode,dataObj);
//dataReply.put(resultJson);
}
}else {
if(!msgData.isEmpty() && msgData!=null && !msgData.equalsIgnoreCase("null"))
if(msgData.charAt(0)=='{'){
dataObj =new JSONObject(msgData);
}
dataReply= operation.operate(featureCode,dataObj);
//dataReply.put(resultJson);
}
}
}
jsReply.put("data", dataReply);
repArray.put(jsReply);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
if(Operation.enterpriseWipe==false){
SharedPreferences mainPref = context.getSharedPreferences( context.getResources().getString(R.string.shared_pref_package), Context.MODE_PRIVATE);
String regId=mainPref.getString(context.getResources().getString(R.string.shared_pref_regId), "");
PayloadParser ps=new PayloadParser();
replyPayload=ps.generateReply(repArray,regId);
if(CommonUtilities.DEBUG_MODE_ENABLED){
Log.e(TAG,"replyPlayload -"+replyPayload);
}
stillProcessing=false;
getOperations(replyPayload);
}
}
}
}

@ -1,18 +1,18 @@
/* /**
~ Copyright (c) 2014, WSO2 Inc. (http://wso2.com/) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ *
~ Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at * You may obtain a copy of the License at
~ *
~ http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
~ limitations under the License. * limitations under the License.
*/ */
package org.wso2.cdm.agent.services; package org.wso2.cdm.agent.services;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
@ -24,7 +24,7 @@ import android.os.Bundle;
import android.telephony.SmsMessage; import android.telephony.SmsMessage;
public class SMSReceiver extends BroadcastReceiver { public class SMSReceiver extends BroadcastReceiver {
ProcessMessage processMsg = null; MessageProcessor processMsg = null;
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@ -54,9 +54,9 @@ public class SMSReceiver extends BroadcastReceiver {
} }
} }
processMsg = new ProcessMessage(context, // processMsg = new MessageProcessor(context,
CommonUtilities.MESSAGE_MODE_SMS, fullMessage, // CommonUtilities.MESSAGE_MODE_SMS, fullMessage,
recipient); // recipient);
} }
} catch (Exception ex) { } catch (Exception ex) {

@ -1,25 +1,26 @@
/* /**
~ Copyright (c) 2014, WSO2 Inc. (http://wso2.com/) All Rights Reserved. * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ *
~ Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at * You may obtain a copy of the License at
~ *
~ http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
~ limitations under the License. * limitations under the License.
*/ */
package org.wso2.cdm.agent.services; package org.wso2.cdm.agent.services;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
@ -48,12 +49,12 @@ public class WSO2DeviceAdminReceiver extends DeviceAdminReceiver implements APIR
String regId=""; String regId="";
Operation operation; Operation operation;
boolean unregState=false; boolean unregState=false;
/** Called when this application is approved to be a device administrator. */ /** Called when this application is approved to be a device administrator. */
@Override @Override
public void onEnabled(Context context, Intent intent) { public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent); super.onEnabled(context, intent);
String policy; String policy;
JSONArray jArray = null;
operation = new Operation(context); operation = new Operation(context);
SharedPreferences mainPref = context.getSharedPreferences("com.mdm", SharedPreferences mainPref = context.getSharedPreferences("com.mdm",
Context.MODE_PRIVATE); Context.MODE_PRIVATE);
@ -61,8 +62,8 @@ public class WSO2DeviceAdminReceiver extends DeviceAdminReceiver implements APIR
editor.putString(context.getResources().getString(R.string.shared_pref_device_active), "1"); editor.putString(context.getResources().getString(R.string.shared_pref_device_active), "1");
editor.commit(); editor.commit();
ProcessMessage pm=new ProcessMessage(context); MessageProcessor pm=new MessageProcessor(context);
pm.getOperations(null); pm.getMessages();
try { try {
policy = mainPref.getString("policy", ""); policy = mainPref.getString("policy", "");
if(policy!=null && !policy.equals("")){ if(policy!=null && !policy.equals("")){
@ -74,6 +75,7 @@ public class WSO2DeviceAdminReceiver extends DeviceAdminReceiver implements APIR
Toast.makeText(context, R.string.device_admin_enabled, Toast.makeText(context, R.string.device_admin_enabled,
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
Log.d(TAG, "onEnabled"); Log.d(TAG, "onEnabled");
LocalNotification.startPolling(context);
} }
@ -98,8 +100,12 @@ public class WSO2DeviceAdminReceiver extends DeviceAdminReceiver implements APIR
String regId = CommonUtilities.getPref(app_context, app_context String regId = CommonUtilities.getPref(app_context, app_context
.getResources().getString(R.string.shared_pref_regId)); .getResources().getString(R.string.shared_pref_regId));
Map<String, String> requestParams = new HashMap<String, String>(); JSONObject requestParams = new JSONObject();
requestParams.put("regid", regId); try {
requestParams.put("regid", regId);
} catch (JSONException e) {
e.printStackTrace();
}
ServerUtils.clearAppData(app_context); ServerUtils.clearAppData(app_context);
ServerUtils.callSecuredAPI(app_context, ServerUtils.callSecuredAPI(app_context,
CommonUtilities.UNREGISTER_ENDPOINT, CommonUtilities.UNREGISTER_ENDPOINT,

@ -22,30 +22,37 @@ import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener;
import android.widget.EditText;
import android.widget.LinearLayout;
/** /**
* *
* The CommonDialogUtils class contains the all dialog templates. * The CommonDialogUtils class contains the all dialog templates.
* *
*/ */
public abstract class CommonDialogUtils { public abstract class CommonDialogUtils {
/** /**
* Return an Alert Dialog with one button. * Return an Alert Dialog with one button.
* *
* @param context the Activity which needs this alert dialog * @param context
* @param message the message in the alert * the Activity which needs this alert dialog
* @param positiveBtnLabel the label of the positive button * @param message
* @param positiveClickListener the onClickListener of the positive button * the message in the alert
* @param positiveBtnLabel
* the label of the positive button
* @param positiveClickListener
* the onClickListener of the positive button
* *
* @return the generated Alert Dialog * @return the generated Alert Dialog
*/ */
public static AlertDialog.Builder getAlertDialogWithOneButton(Context context, public static AlertDialog.Builder getAlertDialogWithOneButton(Context context,
String message, String positiveBtnLabel, String message,
DialogInterface.OnClickListener positiveClickListener) { String positiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message) builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);
.setPositiveButton(positiveBtnLabel, positiveClickListener);
return builder; return builder;
} }
@ -53,99 +60,119 @@ public abstract class CommonDialogUtils {
/** /**
* Return an Alert Dialog with two buttons. * Return an Alert Dialog with two buttons.
* *
* @param context * @param context
* @param context the Activity which needs this alert dialog * @param context
* @param message the message in the alert * the Activity which needs this alert dialog
* @param positiveBtnLabel the label of the positive button * @param message
* @param negetiveBtnLabel the label of the negative button * the message in the alert
* @param positiveClickListener the onClickListener of the positive button * @param positiveBtnLabel
* @param negativeClickListener the onClickListener of the negative button * the label of the positive button
* @param negetiveBtnLabel
* the label of the negative button
* @param positiveClickListener
* the onClickListener of the positive button
* @param negativeClickListener
* the onClickListener of the negative button
* *
* @return the generated Alert Dialog. * @return the generated Alert Dialog.
*/ */
public static AlertDialog.Builder getAlertDialogWithTwoButton(Context context, public static AlertDialog.Builder getAlertDialogWithTwoButton(Context context,
String message, String positiveBtnLabel, String negetiveBtnLabel, String message,
DialogInterface.OnClickListener positiveClickListener, String positiveBtnLabel,
DialogInterface.OnClickListener negativeClickListener) { String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message) builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
.setPositiveButton(positiveBtnLabel, positiveClickListener) .setNegativeButton(negetiveBtnLabel, negativeClickListener);
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
return builder; return builder;
} }
/** /**
* Shows the Network unavailable message. * Shows the Network unavailable message.
* *
* @param context the Activity where checking the network availability. * @param context
* the Activity where checking the network availability.
*/ */
public static void showNetworkUnavailableMessage(Context context) { public static void showNetworkUnavailableMessage(Context context) {
AlertDialog.Builder builder = CommonDialogUtils AlertDialog.Builder builder =
.getAlertDialogWithOneButton( CommonDialogUtils.getAlertDialogWithOneButton(context,
context, context.getResources()
context.getResources().getString(R.string.error_network_unavailable), .getString(R.string.error_network_unavailable),
context.getResources().getString(R.string.button_ok), null); context.getResources()
.getString(R.string.button_ok),
null);
builder.show(); builder.show();
} }
public static AlertDialog.Builder getAlertDialogWithTwoButtonAndTitle(Context context, public static AlertDialog.Builder getAlertDialogWithTwoButtonAndTitle(Context context,
String title, String message, String title,
String positiveBtnLabel, String negetiveBtnLabel, String message,
DialogInterface.OnClickListener positiveClickListener, String positiveBtnLabel,
DialogInterface.OnClickListener negativeClickListener) { String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title); builder.setTitle(title);
builder.setMessage(message) builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
.setPositiveButton(positiveBtnLabel, positiveClickListener) .setNegativeButton(negetiveBtnLabel, negativeClickListener);
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
return builder; return builder;
} }
/** /**
* Returns an Alert Dialog with one button and title. * Returns an Alert Dialog with one button and title.
* *
* @param context the activity which need this alert. * @param context
* @param title the alert title * the activity which need this alert.
* @param message the alert message * @param title
* @param positiveBtnLabel the positive button label * the alert title
* @param positiveClickListener the positive button listener * @param message
* the alert message
* @param positiveBtnLabel
* the positive button label
* @param positiveClickListener
* the positive button listener
* *
* @return an alert dialog * @return an alert dialog
*/ */
public static AlertDialog.Builder getAlertDialogWithOneButtonAndTitle(Context context, public static AlertDialog.Builder getAlertDialogWithOneButtonAndTitle(Context context,
String title, String message, String title,
String positiveBtnLabel, DialogInterface.OnClickListener positiveClickListener) { String message,
String positiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title); builder.setTitle(title);
builder.setMessage(message) builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);
.setPositiveButton(positiveBtnLabel, positiveClickListener);
builder.show(); builder.show();
return builder; return builder;
} }
/** /**
* Shows the ProgressDialog. * Shows the ProgressDialog.
* *
* @param context the Activity which needs the ProgressDialog * @param context
* @param title the title * the Activity which needs the ProgressDialog
* @param message the message * @param title
* @param cancelListener the OnCancelListener * the title
* @param message
* the message
* @param cancelListener
* the OnCancelListener
*/ */
public static ProgressDialog showPrgressDialog (Context context, String title, String message, OnCancelListener cancelListener) { public static ProgressDialog showPrgressDialog(Context context, String title, String message,
ProgressDialog progressDialog = ProgressDialog.show(context, OnCancelListener cancelListener) {
title, ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true);
message, true);
progressDialog.setCancelable(true); progressDialog.setCancelable(true);
progressDialog.setOnCancelListener(cancelListener); progressDialog.setOnCancelListener(cancelListener);
return progressDialog; return progressDialog;
} }
/** /**
* Stops progressDialog. * Stops progressDialog.
* *
@ -156,4 +183,26 @@ public abstract class CommonDialogUtils {
} }
} }
public static AlertDialog.Builder getAlertDialogWithTwoButtonAndEditView(Context context,
String message,
String positiveBtnLabel,
String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener,
EditText input) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
LinearLayout.LayoutParams lp =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
builder.setView(input);
return builder;
}
} }

@ -36,20 +36,22 @@ public class CommonUtilities {
public static String SERVER_PORT = "9763"; public static String SERVER_PORT = "9763";
public static String SERVER_PROTOCOL = "http://"; public static String SERVER_PROTOCOL = "http://";
public static String API_VERSION = "1.0.0"; public static String API_VERSION = "1.0.0";
public static String API_SERVER_PORT = "8280";
public static String SERVER_APP_ENDPOINT = "/cdm-android-api/"; public static String SERVER_APP_ENDPOINT = "/cdm-android-api/";
public static String SERVER_AUTHENTICATION_ENDPOINT="register/authenticate/device"; public static String SERVER_AUTHENTICATION_ENDPOINT="register/authenticate/device";
public static String LICENSE_ENDPOINT = "register/authenticate/device/license"; public static String LICENSE_ENDPOINT = "/license/"+API_VERSION;
public static String REGISTER_ENDPOINT = "enrollment/authenticate/device/enroll"; public static String REGISTER_ENDPOINT = "/enroll/"+API_VERSION;
public static String OAUTH_ENDPOINT = "/oauth2/token"; public static String OAUTH_ENDPOINT = "/oauth2/token";
public static String SENDER_ID_ENDPOINT = "devices/sender_id/"; public static String SENDER_ID_ENDPOINT = "devices/sender_id/";
public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/"; public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/";
public static String UNREGISTER_ENDPOINT = "devices/unregister/"; public static String UNREGISTER_ENDPOINT = "devices/unregister/";
public static String NOTIFICATION_ENDPOINT = "notifications/pendingOperations/"; public static String NOTIFICATION_ENDPOINT = "/operation/"+API_VERSION;
public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":" public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":"
+ SERVER_PORT + SERVER_APP_ENDPOINT; + SERVER_PORT ;
public static String API_SERVER_URL;
public static final String TRUSTSTORE_PASSWORD = "wso2carbon"; public static final String TRUSTSTORE_PASSWORD = "wso2carbon";
@ -86,7 +88,7 @@ public class CommonUtilities {
SERVER_IP = serverIP; SERVER_IP = serverIP;
SERVER_URL = SERVER_PROTOCOL + serverIP + ":" + SERVER_PORT SERVER_URL = SERVER_PROTOCOL + serverIP + ":" + SERVER_PORT
+SERVER_APP_ENDPOINT; +SERVER_APP_ENDPOINT;
API_SERVER_URL=SERVER_PROTOCOL + SERVER_IP + ":" + API_SERVER_PORT ;
} }
/** /**
@ -140,7 +142,7 @@ public class CommonUtilities {
public static final String OPERATION_DEVICE_INFO = "500A"; public static final String OPERATION_DEVICE_INFO = "500A";
public static final String OPERATION_DEVICE_LOCATION = "501A"; public static final String OPERATION_DEVICE_LOCATION = "501A";
public static final String OPERATION_GET_APPLICATION_LIST = "502A"; public static final String OPERATION_GET_APPLICATION_LIST = "502A";
public static final String OPERATION_LOCK_DEVICE = "503A"; public static final String OPERATION_LOCK_DEVICE = "DEVICE_LOCK";
public static final String OPERATION_WIPE_DATA = "504A";//reset device public static final String OPERATION_WIPE_DATA = "504A";//reset device
public static final String OPERATION_CLEAR_PASSWORD = "505A"; public static final String OPERATION_CLEAR_PASSWORD = "505A";
public static final String OPERATION_NOTIFICATION = "506A"; public static final String OPERATION_NOTIFICATION = "506A";

@ -23,5 +23,8 @@ public class Constant {
public static final String PASSWORD = "password"; public static final String PASSWORD = "password";
public static final String STATUS = "status"; public static final String STATUS = "status";
public static final String RESPONSE = "response"; public static final String RESPONSE = "response";
public static final String PROPERTIES = "properties";
public static final String CODE = "code";
public static final String LOCAL = "LOCAL";
} }

@ -44,7 +44,6 @@ import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.net.ParseException; import android.net.ParseException;
import android.util.Log; import android.util.Log;
@ -54,25 +53,6 @@ public class HTTPConnectorUtils {
private static final int MAX_ATTEMPTS = 2; private static final int MAX_ATTEMPTS = 2;
// public static Map<String, String> getClientKey(String username, String
// password, Context context) {
// Map<String, String> params = new HashMap<String, String>();
// Map<String, String> response = new HashMap<String, String>();
//
// params.put("username", username);
// params.put("password", password);
//
// try {
// response =
// postData("services/register/authenticate/device", params,
// context);
// } catch (Exception ex) {
// ex.printStackTrace();
// return response;
// }
// return response;
// }
public static Map<String, String> postData(Context context, String url, public static Map<String, String> postData(Context context, String url,
Map<String, String> params) { Map<String, String> params) {
Map<String, String> response = null; Map<String, String> response = null;
@ -121,7 +101,6 @@ public class HTTPConnectorUtils {
} }
String body = bodyBuilder.toString(); String body = bodyBuilder.toString();
Log.v(TAG, "Posting '" + body + "' to " + url);
byte[] postData = body.getBytes(); byte[] postData = body.getBytes();
HttpPost httppost = new HttpPost(url); HttpPost httppost = new HttpPost(url);

@ -1,34 +1,23 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.utils; package org.wso2.cdm.agent.utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.security.KeyStore;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import org.apache.http.HeaderElement; import org.json.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HTTP;
import org.wso2.cdm.agent.R; import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.proxy.APIController; import org.wso2.cdm.agent.proxy.APIController;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
@ -40,16 +29,11 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.net.ParseException;
import android.util.Log; import android.util.Log;
public class ServerUtils { public class ServerUtils {
public static String TAG = ServerUtils.class.getSimpleName(); public static String TAG = ServerUtils.class.getSimpleName();
private static final int MAX_ATTEMPTS = 2;
private static final int BACKOFF_MILLI_SECONDS = 2000;
private static final Random random = new Random();
/** /**
* calls the secured API * calls the secured API
@ -69,18 +53,13 @@ public class ServerUtils {
* @param requestCode * @param requestCode
* the request code * the request code
*/ */
public static void callSecuredAPI(Context context, String endpoint, public static void callSecuredAPI(Context context, String endpoint,
String methodType, Map<String, String> requestParams, String methodType, JSONObject requestParams,
APIResultCallBack apiResultCallBack, int requestCode) { APIResultCallBack apiResultCallBack, int requestCode) {
String serverIP = CommonUtilities.getPref(context, context
.getResources().getString(R.string.shared_pref_ip)); Log.e("",endpoint);
String serverURL = CommonUtilities.SERVER_PROTOCOL + serverIP + ":"
+ CommonUtilities.SERVER_PORT
+ CommonUtilities.SERVER_APP_ENDPOINT;
APIUtilities apiUtilities = new APIUtilities(); APIUtilities apiUtilities = new APIUtilities();
apiUtilities.setEndPoint(serverURL + endpoint apiUtilities.setEndPoint(endpoint);
+ CommonUtilities.API_VERSION);
apiUtilities.setHttpMethod(methodType); apiUtilities.setHttpMethod(methodType);
if (requestParams != null) { if (requestParams != null) {
apiUtilities.setRequestParams(requestParams); apiUtilities.setRequestParams(requestParams);

Loading…
Cancel
Save