Added changes to the maven archetype

merge-requests/1/head
harshanL 10 years ago
parent 73e73e8f53
commit 73359d4b95

@ -80,7 +80,7 @@ public class Operation {
try {
dmService = AndroidAPIUtils.getDeviceManagementService();
//TODO: need to complete getOperation logic
//TODO: need to complete updateOperation logic
boolean result = dmService.getOperationManager("").addOperation(null, null);
if (result) {
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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100"
android:versionName="4.2.0" package="com.actionbarsherlock">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="100" android:versionName="4.2.0" package="com.actionbarsherlock">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>

@ -115,8 +115,8 @@ public abstract class ActionBarSherlock {
* Register an ActionBarSherlock implementation.
*
* @param implementationClass Target implementation class which extends
* {@link com.actionbarsherlock.ActionBarSherlock}. This class must also be annotated with
* {@link com.actionbarsherlock.ActionBarSherlock.Implementation}.
* {@link ActionBarSherlock}. This class must also be annotated with
* {@link Implementation}.
*/
public static void registerImplementation(Class<? extends ActionBarSherlock> implementationClass) {
if (!implementationClass.isAnnotationPresent(Implementation.class)) {
@ -332,7 +332,7 @@ public abstract class ActionBarSherlock {
/**
* 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();

@ -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
* 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>
* <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>
* <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
* 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
* 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">
* <h3>Developer Guides</h3>
* <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();
/**
* 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.
*
* <p>Very often tabs will be used to switch between {@link Fragment}
@ -507,7 +507,7 @@ public abstract class ActionBar {
*
* @return A new Tab
*
* @see #addTab(com.actionbarsherlock.app.ActionBar.Tab)
* @see #addTab(Tab)
*/
public abstract Tab newTab();
@ -807,7 +807,7 @@ public abstract class ActionBar {
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.
*
* @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
* running after that delay elapses. A non-delayed animation will have its initial
* 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
* 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
* 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
* {@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>
*/
@ -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
* 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.
*
* <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.
*
* <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
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.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
* used in conjunction with methods in the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet.Builder Builder}
* either the {@link AnimatorSet#playTogether(Animator[]) playTogether()} or
* {@link AnimatorSet#playSequentially(Animator[]) playSequentially()} methods can be called to add
* a set of animations all at once, or the {@link AnimatorSet#play(Animator)} can be
* used in conjunction with methods in the {@link AnimatorSet.Builder Builder}
* class to add animations
* 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
* <code>AnimatorSet</code> along with the relationships between the various animations. The
* 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
* use the {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playTogether(Animator[]) playTogether()} and {@link
* com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#playSequentially(Animator[]) playSequentially()} methods if these suit the need,
* use the {@link AnimatorSet#playTogether(Animator[]) playTogether()} and {@link
* 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.
* <p/>
* <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>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>
@ -977,14 +977,14 @@ public final class AnimatorSet extends Animator {
* s.play(anim4).after(anim3);
* </pre>
* <p/>
* <p>Note in the example that both {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet.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
* <p>Note in the example that both {@link Builder#before(Animator)} and {@link
* 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,
* depending on the situation.</p>
* <p/>
* <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
* {@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
* and anim3 when anim1 ends; there is no direct dependency relationship between anim2 and
* 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
* {@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
* {@link com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet#play(Animator)} method starts.
* {@link AnimatorSet#play(Animator)} method starts.
*/
public Builder with(Animator 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
* {@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.
*
* @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) {
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
* {@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.
*
* @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) {
Node node = mNodeMap.get(anim);
@ -1092,7 +1092,7 @@ public final class AnimatorSet extends Animator {
/**
* 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.
*
* @param delay The number of milliseconds that should elapse before the

@ -17,12 +17,12 @@
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
* custom evaulators for types that are not automatically understood and used by the animation
* system.
*
* @see ValueAnimator#setEvaluator(com.actionbarsherlock.internal.nineoldandroids.animation.TypeEvaluator)
* @see ValueAnimator#setEvaluator(TypeEvaluator)
*/
public interface TypeEvaluator<T> {

@ -38,7 +38,7 @@ import java.util.HashMap;
* <p>By default, ValueAnimator uses non-linear time interpolation, via the
* {@link AccelerateDecelerateInterpolator} class, which accelerates into and decelerates
* 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"})
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
* 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>
* 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.
*
* @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 main 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
* {@link AnimatorUpdateListener#onAnimationUpdate(ValueAnimator)}, which
* is called during each animation frame, immediately after the value is calculated.
*
* @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.
* 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 menu Menu to host

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

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

@ -112,16 +112,16 @@ public abstract class ActionMode {
/**
* Invalidate the action mode and refresh menu content. The mode's
* {@link com.actionbarsherlock.view.ActionMode.Callback} will have its
* {@link com.actionbarsherlock.view.ActionMode.Callback#onPrepareActionMode(com.actionbarsherlock.view.ActionMode, Menu)} method called.
* {@link ActionMode.Callback} will have its
* {@link Callback#onPrepareActionMode(ActionMode, Menu)} method called.
* If it returns true the menu will be scanned for updated content and any relevant changes
* will be reflected to the user.
*/
public abstract void invalidate();
/**
* Finish and close this action mode. The action mode's {@link com.actionbarsherlock.view.ActionMode.Callback} will
* have its {@link com.actionbarsherlock.view.ActionMode.Callback#onDestroyActionMode(com.actionbarsherlock.view.ActionMode)} method called.
* Finish and close this action mode. The action mode's {@link ActionMode.Callback} will
* have its {@link Callback#onDestroyActionMode(ActionMode)} method called.
*/
public abstract void finish();
@ -168,18 +168,18 @@ public abstract class ActionMode {
/**
* 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.
*
* <p>An action mode's lifecycle is as follows:
* <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>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onPrepareActionMode(com.actionbarsherlock.view.ActionMode, Menu)} after creation
* and any time the {@link com.actionbarsherlock.view.ActionMode} is invalidated</li>
* <li>{@link com.actionbarsherlock.view.ActionMode.Callback#onActionItemClicked(com.actionbarsherlock.view.ActionMode, MenuItem)} any time a
* <li>{@link Callback#onPrepareActionMode(ActionMode, Menu)} after creation
* and any time the {@link ActionMode} is invalidated</li>
* <li>{@link Callback#onActionItemClicked(ActionMode, MenuItem)} any time a
* 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>
* </ul>
*/

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

@ -26,7 +26,7 @@ import android.view.KeyEvent;
* 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
* 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
* {@link Activity#onContextItemSelected(MenuItem)}.
* <p>

@ -68,8 +68,8 @@ public interface MenuItem {
* Interface definition for a callback to be invoked when a menu item is
* clicked.
*
* @see Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem)
* @see Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem)
* @see Activity#onContextItemSelected(MenuItem)
* @see Activity#onOptionsItemSelected(MenuItem)
*/
public interface OnMenuItemClickListener {
/**
@ -87,16 +87,16 @@ public interface MenuItem {
/**
* 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.
*
* @see com.actionbarsherlock.view.MenuItem#expandActionView()
* @see com.actionbarsherlock.view.MenuItem#collapseActionView()
* @see com.actionbarsherlock.view.MenuItem#setShowAsActionFlags(int)
* @see MenuItem#expandActionView()
* @see MenuItem#collapseActionView()
* @see MenuItem#setShowAsActionFlags(int)
*/
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.
* @param item Item that was expanded
* @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);
/**
* 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.
* @param item Item that was collapsed
* @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
* situations, it is more efficient and easier to use
* {@link Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem)} or
* {@link Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem)}.
* {@link Activity#onOptionsItemSelected(MenuItem)} or
* {@link Activity#onContextItemSelected(MenuItem)}.
*
* @param menuItemClickListener The object to receive invokations.
* @return This Item so additional setters can be called.
* @see Activity#onOptionsItemSelected(com.actionbarsherlock.view.MenuItem)
* @see Activity#onContextItemSelected(com.actionbarsherlock.view.MenuItem)
* @see Activity#onOptionsItemSelected(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
@ -552,8 +552,8 @@ public interface MenuItem {
* Expand the action view associated with this menu item.
* 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 #setOnActionExpandListener(com.actionbarsherlock.view.MenuItem.OnActionExpandListener)}
* it will have its {@link com.actionbarsherlock.view.MenuItem.OnActionExpandListener#onMenuItemActionExpand(com.actionbarsherlock.view.MenuItem)}
* If a listener has been set using {@link #setOnActionExpandListener(OnActionExpandListener)}
* it will have its {@link OnActionExpandListener#onMenuItemActionExpand(MenuItem)}
* method invoked. The listener may return false from this method to prevent expanding
* the action view.
*
@ -565,8 +565,8 @@ public interface MenuItem {
* Collapse the action view associated with this menu item.
* 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 #setOnActionExpandListener(com.actionbarsherlock.view.MenuItem.OnActionExpandListener)} it will have its
* {@link com.actionbarsherlock.view.MenuItem.OnActionExpandListener#onMenuItemActionCollapse(com.actionbarsherlock.view.MenuItem)} method invoked.
* {@link #setOnActionExpandListener(OnActionExpandListener)} it will have its
* {@link OnActionExpandListener#onMenuItemActionCollapse(MenuItem)} method invoked.
* The listener may return false from this method to prevent collapsing the action view.
*
* @return true if the action view was collapsed, false otherwise.
@ -581,12 +581,12 @@ public interface MenuItem {
* @see #expandActionView()
* @see #collapseActionView()
* @see #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
* @see com.actionbarsherlock.view.MenuItem.OnActionExpandListener
* @see OnActionExpandListener
*/
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
* be configured to expand or collapse its action view using the flag
* {@link #SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW}.

@ -95,12 +95,12 @@ import java.util.concurrent.Executors;
class ActivityChooserModel extends DataSetObservable {
/**
* Client that utilizes an {@link com.actionbarsherlock.widget.ActivityChooserModel}.
* Client that utilizes an {@link ActivityChooserModel}.
*/
public interface ActivityChooserModelClient {
/**
* Sets the {@link com.actionbarsherlock.widget.ActivityChooserModel}.
* Sets the {@link ActivityChooserModel}.
*
* @param dataModel The model.
*/
@ -124,7 +124,7 @@ class ActivityChooserModel extends DataSetObservable {
// This cannot be done by a simple comparator since an Activity weight
// is computed from history. Note that Activity implements Comparable.
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
* 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.
* <p>
* <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.
* @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);
}
@ -407,7 +407,7 @@ class ActivityChooserModel extends DataSetObservable {
*
* @return The activity.
*
* @see com.actionbarsherlock.widget.ActivityChooserModel.ActivityResolveInfo
* @see ActivityResolveInfo
* @see #setIntent(Intent)
*/
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
* policy has consumed the intent.
*
* @see com.actionbarsherlock.widget.ActivityChooserModel.HistoricalRecord
* @see com.actionbarsherlock.widget.ActivityChooserModel.OnChooseActivityListener
* @see HistoricalRecord
* @see OnChooseActivityListener
*/
public Intent chooseActivity(int index) {
ActivityResolveInfo chosenActivity = mActivites.get(index);
@ -593,7 +593,7 @@ class ActivityChooserModel extends DataSetObservable {
*
* @param activitySorter The sorter.
*
* @see com.actionbarsherlock.widget.ActivityChooserModel.ActivitySorter
* @see ActivitySorter
*/
public void setActivitySorter(ActivitySorter activitySorter) {
synchronized (mInstanceLock) {
@ -609,7 +609,7 @@ class ActivityChooserModel extends DataSetObservable {
* Sorts the activities based on history and an intent. If
* a sorter is not specified this a default implementation is used.
*
* @see #setActivitySorter(com.actionbarsherlock.widget.ActivityChooserModel.ActivitySorter)
* @see #setActivitySorter(ActivitySorter)
*/
private void sortActivities() {
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 {
@Override

@ -1,212 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2014 - 2015, 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.
-->
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.actionbarsherlock</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>4.2.0</version>
<name>ActionBarSherlock (Parent)</name>
<description>Android library for implementing the action bar design pattern using the backported
sources of Ice Cream Sandwich.
</description>
<url>http://actionbarsherlock.com</url>
<inceptionYear>2011</inceptionYear>
<modules>
<module>library</module>
<module>samples</module>
</modules>
<scm>
<url>https://github.com/JakeWharton/ActionBarSherlock/</url>
<connection>scm:git:git://github.com/JakeWharton/ActionBarSherlock.git</connection>
<developerConnection>scm:git:git@github.com:JakeWharton/ActionBarSherlock.git
</developerConnection>
</scm>
<developers>
<developer>
<name>Jake Wharton</name>
<email>jakewharton@gmail.com</email>
<id>jakewharton</id>
<url>http://jakewharton.com</url>
<timezone>-5</timezone>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>
<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Jake Wharton</name>
<url>http://jakewharton.com</url>
</organization>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/JakeWharton/ActionBarSherlock/issues</url>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
<android.version>4.0.1.2</android.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>
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.actionbarsherlock</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>4.2.0</version>
<name>ActionBarSherlock (Parent)</name>
<description>Android library for implementing the action bar design pattern using the backported sources of Ice Cream Sandwich.</description>
<url>http://actionbarsherlock.com</url>
<inceptionYear>2011</inceptionYear>
<modules>
<module>library</module>
<module>samples</module>
</modules>
<scm>
<url>https://github.com/JakeWharton/ActionBarSherlock/</url>
<connection>scm:git:git://github.com/JakeWharton/ActionBarSherlock.git</connection>
<developerConnection>scm:git:git@github.com:JakeWharton/ActionBarSherlock.git</developerConnection>
</scm>
<developers>
<developer>
<name>Jake Wharton</name>
<email>jakewharton@gmail.com</email>
<id>jakewharton</id>
<url>http://jakewharton.com</url>
<timezone>-5</timezone>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>
<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Jake Wharton</name>
<url>http://jakewharton.com</url>
</organization>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/JakeWharton/ActionBarSherlock/issues</url>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
<android.version>4.0.1.2</android.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>
<systemPath>${basedir}/libs/android-support-v4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.github.rtyley</groupId>
<artifactId>roboguice-sherlock</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.5</version>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
</execution>
</executions>
<configuration>
<message>Creating site for ${project.version}.</message>
<outputDirectory>website</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.github.rtyley</groupId>
<artifactId>roboguice-sherlock</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.5</version>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
</execution>
</executions>
<configuration>
<message>Creating site for ${project.version}.</message>
<outputDirectory>website</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>

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

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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="already_registered">Device is already registered on server.</string>
@ -52,6 +55,7 @@
<string name="device_enroll_type_cope">COPE</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_confirm_pin">Re-type the PIN to Confirm</string>
<!-- TEXT FIELD HINTS -->
<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_interval">interval</string>
<string name="username">username</string>
<string name="shared_pref_device_active">0</string>
<string name="shared_pref_client_id">${clientKey}</string>
<string name="shared_pref_client_secret">${clientSecret}</string>
<string name="shared_pref_client_id">ClientID</string>
<string name="shared_pref_client_secret">ClientSecret</string>
<!-- PARA KEYS -->
@ -156,6 +162,7 @@
<!-- BUTTON TITLES -->
<string name="button_ok">OK</string>
<string name="button_cancel">Cancel</string>
<!-- APPLICATION MANAGER -->
<string name="application_mgr_download_location">/Download/</string>
@ -171,5 +178,8 @@
<!-- Headings -->
<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>

@ -1,12 +1,12 @@
/**
* 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.
@ -27,25 +27,26 @@ public class AlertActivity extends SherlockActivity {
String message = "";
Button btnOK;
TextView txtMessage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alert);
btnOK = (Button)findViewById(R.id.btnOK);
txtMessage = (TextView)findViewById(R.id.txtMessage);
btnOK = (Button) findViewById(R.id.btnOK);
txtMessage = (TextView) findViewById(R.id.txtMessage);
Bundle extras = getIntent().getExtras();
if (extras != null) {
if(extras.containsKey( getResources().getString(R.string.intent_extra_message))){
message = extras.getString( 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));
}
}
txtMessage.setText(message);
btnOK.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub

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

@ -1,12 +1,12 @@
/**
* 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.
@ -15,28 +15,21 @@
*/
package org.wso2.cdm.agent;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.api.PhoneState;
import org.wso2.cdm.agent.proxy.APIAccessCallBack;
import org.wso2.cdm.agent.proxy.APIResultCallBack;
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.CommonUtilities;
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.ServerUtils;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -44,11 +37,8 @@ import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings.Secure;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
@ -64,14 +54,12 @@ import android.widget.Toast;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.google.android.gcm.GCMRegistrar;
/**
* Activity that captures username, password and device ownership details.
*/
public class AuthenticationActivity extends SherlockActivity implements APIAccessCallBack,
APIResultCallBack {
APIResultCallBack {
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().setTitle(R.string.empty_app_title);
View homeIcon =
(View) findViewById(
Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
? android.R.id.home
: R.id.abs__home).getParent();
(View) findViewById(
Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
? android.R.id.home
: R.id.abs__home
).getParent();
homeIcon.setVisibility(View.GONE);
context = AuthenticationActivity.this;
@ -160,11 +149,13 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(View view) {
if (etUsername.getText() != null &&
!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();
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();
}
@ -180,13 +171,21 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
messageBuilder.append(" ");
messageBuilder.append(getResources().getString(R.string.dialog_init_end));
alertDialog =
CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context,
getResources().getString(R.string.dialog_init_device_type),
messageBuilder.toString(),
getResources().getString(R.string.yes),
getResources().getString(R.string.no),
dialogClickListener,
dialogClickListener);
CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context,
getResources()
.getString(
R.string.dialog_init_device_type),
messageBuilder
.toString(),
getResources()
.getString(
R.string.yes),
getResources()
.getString(
R.string.no),
dialogClickListener,
dialogClickListener
);
alertDialog.show();
} else {
if (etUsername.getText() != null &&
@ -209,12 +208,12 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
startAuthentication();
dialog.dismiss();
break;
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
startAuthentication();
break;
}
}
@ -224,10 +223,12 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
* Start authentication process.
*/
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.
if (PhoneState.isNetworkAvailable(context)) {
authenticate();
initializeIDPLib(getResources().getString(R.string.client_id),
getResources().getString(R.string.client_secret));
} else {
CommonDialogUtils.stopProgressDialog(progressDialog);
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() {
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 =
null;
Map<String, String> requestParametres =
new HashMap<String, String>();
private void initializeIDPLib(String clientKey, String clientSecret) {
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();
requestParametres.put(Constant.USERNAME,
usernameVal);
requestParametres.put(Constant.PASSWORD,
passwordVal);
response =
HTTPConnectorUtils.postData(context,
CommonUtilities.SERVER_URL +
CommonUtilities.SERVER_AUTHENTICATION_ENDPOINT,
requestParametres);
return response;
}
} else {
usernameForRegister = etUsername.getText().toString().trim();
}
IdentityProxy.getInstance().init(clientKey, clientSecret, usernameForRegister, passwordVal,
serverURL, AuthenticationActivity.this,
this.getApplicationContext());
}
@Override
protected void onPreExecute() {
progressDialog =
ProgressDialog.show(context,
getResources().getString(R.string.dialog_authenticate),
getResources().getString(R.string.dialog_please_wait),
true);
@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();
@Override
protected void onPostExecute(Map<String, String> result) {
authenticateResponse(result);
// Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) {
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
@ -330,11 +323,11 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
*/
private void getLicense() {
String licenseAgreedResponse =
Preference.get(context,
getResources().getString(R.string.shared_pref_isagreed));
Preference.get(context,
getResources().getString(R.string.shared_pref_isagreed));
String type =
Preference.get(context,
getResources().getString(R.string.shared_pref_reg_type));
Preference.get(context,
getResources().getString(R.string.shared_pref_reg_type));
// No need to display license for COPE devices
if (type.trim().equals(getResources().getString(R.string.device_enroll_type_byod))) {
@ -346,18 +339,28 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
@Override
public void onCancel(DialogInterface arg0) {
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_enrollment_failed_detail),
getResources().getString(R.string.error_enrollment_failed),
getResources().getString(R.string.button_ok),
null);
getResources()
.getString(
R.string.error_enrollment_failed_detail),
getResources()
.getString(
R.string.error_enrollment_failed),
getResources()
.getString(
R.string.button_ok),
null
);
}
};
progressDialog =
CommonDialogUtils.showPrgressDialog(context,
getResources().getString(R.string.dialog_license_agreement),
getResources().getString(R.string.dialog_please_wait),
cancelListener);
CommonDialogUtils.showPrgressDialog(context,
getResources().getString(
R.string.dialog_license_agreement),
getResources().getString(
R.string.dialog_please_wait),
cancelListener
);
// Check network connection availability before calling the API.
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() {
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 =
new AsyncTask<Void, Void, Map<String, String>>() {
@Override
protected Map<String, String> doInBackground(Void... params) {
Map<String, String> response =
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();
@Override
public void onReceiveAPIResult(Map<String, String> result, int requestCode) {
if (requestCode == CommonUtilities.SENDER_ID_REQUEST_CODE) {
//manipulateSenderIdResponse(result);
} else if (requestCode == CommonUtilities.LICENSE_REQUEST_CODE) {
manipulateLicenseResponse(result);
}
}
/**
* Manipulates the License agreement response received from server.
*
* @param result
* the result of the license agreement request
*
* @param result the result of the license agreement request
*/
private void manipulateLicenseResponse(Map<String, String> result) {
String responseStatus;
@ -432,8 +420,9 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
licenseAgreement);
showAgreement(licenseAgreement, CommonUtilities.EULA_TITLE);
} else {
showErrorMessage(getResources().getString(R.string.error_enrollment_failed_detail),
getResources().getString(R.string.error_enrollment_failed));
showErrorMessage(
getResources().getString(R.string.error_enrollment_failed_detail),
getResources().getString(R.string.error_enrollment_failed));
}
} else if (responseStatus.equals(CommonUtilities.INTERNAL_SERVER_ERROR)) {
@ -460,11 +449,18 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
cancelEntry();
dialog.dismiss();
}
});
}
);
AlertDialog alert = builder.create();
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) {
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom_terms_popup);
@ -523,8 +519,8 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void cancelEntry() {
SharedPreferences mainPref =
context.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
context.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_policy), "");
editor.putString(getResources().getString(R.string.shared_pref_isagreed), "0");
@ -551,7 +547,8 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
// cancelEntry();
dialog.cancel();
}
});
}
);
AlertDialog alert = builder.create();
alert.show();
}
@ -566,44 +563,15 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
}
);
AlertDialog alert = builder.create();
alert.show();
}
/**
* Initialize the Android IDP sdk by passing user credentials,client ID and
* client secret.
* Validation done to see if the username and password fields are properly entered.
*/
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() {
boolean isReady = false;
@ -626,7 +594,6 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
getSupportMenuInflater().inflate(R.menu.auth_sherlock_menu, menu);
return true;
}
@ -636,8 +603,9 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
switch (item.getItemId()) {
case R.id.ip_setting:
SharedPreferences mainPref =
AuthenticationActivity.this.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
AuthenticationActivity.this.getSharedPreferences(
getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
Editor editor = mainPref.edit();
editor.putString(getResources().getString(R.string.shared_pref_ip), "");
editor.commit();
@ -668,222 +636,62 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
}
DialogInterface.OnClickListener senderIdFailedClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
etUsername.setText(CommonUtilities.EMPTY_STRING);
etPassword.setText(CommonUtilities.EMPTY_STRING);
etDomain.setText(CommonUtilities.EMPTY_STRING);
btnRegister.setEnabled(false);
btnRegister.setBackground(getResources().getDrawable(R.drawable.btn_grey));
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);
}
}
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
etUsername.setText(CommonUtilities.EMPTY_STRING);
etPassword.setText(CommonUtilities.EMPTY_STRING);
etDomain.setText(CommonUtilities.EMPTY_STRING);
btnRegister.setEnabled(false);
btnRegister.setBackground(getResources().getDrawable(R.drawable.btn_grey));
btnRegister.setTextColor(getResources().getColor(R.color.black));
}
};
private void showEnrollementFailedErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_enrollment_failed),
getResources().getString(R.string.error_enrollment_failed_detail),
getResources().getString(R.string.button_ok),
senderIdFailedClickListener);
}
private void managePushNotification(String mode, float interval, Editor editor) {
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();
}
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(
R.string.error_enrollment_failed),
getResources().getString(
R.string.error_enrollment_failed_detail),
getResources().getString(
R.string.button_ok),
senderIdFailedClickListener
);
}
private void showInternalServerErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog);
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);
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
);
}
/**
* Shows common error message for authentication.
*
*/
private void showAuthCommonErrorMessage() {
CommonDialogUtils.stopProgressDialog(progressDialog);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.title_head_authentication_error),
getResources().getString(R.string.error_for_all_unknown_authentication_failures),
getResources().getString(R.string.button_ok),
null);
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(
R.string.title_head_authentication_error),
getResources().getString(
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.api.ApplicationManager;
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 android.app.Notification;
@ -41,7 +41,7 @@ public class GCMIntentService extends GCMBaseIntentService {
DevicePolicyManager devicePolicyManager;
ApplicationManager appList;
static final int ACTIVATION_REQUEST = 47;
ProcessMessage processMsg = null;
MessageProcessor processMsg = null;
@SuppressWarnings("hiding")
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));
if(mode.trim().toUpperCase().equals("GCM")){
Log.e("onmsg","GCM");
ProcessMessage msg=new ProcessMessage(context);
msg.getOperations(null);
MessageProcessor msg=new MessageProcessor(context);
msg.getMessages();
}
else{
Log.e("onmsg","mode");

@ -1,12 +1,12 @@
/**
* 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.
@ -15,7 +15,6 @@
*/
package org.wso2.cdm.agent;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@ -23,7 +22,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@ -35,8 +33,12 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
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.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.Preference;
public class PinCodeActivity extends Activity {
@ -45,62 +47,62 @@ public class PinCodeActivity extends Activity {
private EditText txtOldPin;
private Button btnPin;
private String username = null;
private String REG_ID = "";
private String regId = "";
private final int TAG_BTN_SET_PIN = 0;
private String FROM_ACTIVITY = null;
private String MAIN_ACTIVITY = null;
private String fromActivity = null;
Context context;
AlertDialog.Builder alertDialog;
EditText input;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pin_code);
context=PinCodeActivity.this;
context = PinCodeActivity.this;
Bundle extras = getIntent().getExtras();
if (extras != null) {
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))) {
REG_ID = 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));
regId = extras.getString(getResources().getString(R.string.intent_extra_regid));
}
if(extras.containsKey(getResources().getString(R.string.intent_extra_main_activity))){
MAIN_ACTIVITY = extras.getString(getResources().getString(R.string.intent_extra_main_activity));
if (extras.containsKey(getResources().getString(R.string.intent_extra_from_activity))) {
fromActivity = extras.getString(
getResources().getString(R.string.intent_extra_from_activity));
}
}
lblPin = (TextView) findViewById(R.id.lblPin);
txtPin = (EditText) findViewById(R.id.txtPinCode);
txtOldPin = (EditText) findViewById(R.id.txtOldPinCode);
btnPin = (Button) findViewById(R.id.btnSetPin);
btnPin.setTag(TAG_BTN_SET_PIN);
btnPin.setOnClickListener(onClickListener_BUTTON_CLICKED);
btnPin.setOnClickListener(onClickListenerButtonClicked);
btnPin.setEnabled(false);
btnPin.setBackground(getResources().getDrawable(R.drawable.btn_grey));
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);
txtOldPin.setVisibility(View.VISIBLE);
txtPin.setHint(getResources().getString(R.string.hint_new_pin));
txtPin.setEnabled(true);
txtPin.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
int count) {
enableNewPINSubmitIfReady();
}
@ -109,16 +111,16 @@ public class PinCodeActivity extends Activity {
enableSubmitIfReady();
}
});
txtOldPin.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
int count) {
enableNewPINSubmitIfReady();
}
@ -127,16 +129,16 @@ public class PinCodeActivity extends Activity {
enableSubmitIfReady();
}
});
}else{
} else {
txtPin.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
int count) {
enableSubmitIfReady();
}
@ -148,26 +150,48 @@ public class PinCodeActivity extends Activity {
}
}
OnClickListener onClickListener_BUTTON_CLICKED = new OnClickListener() {
OnClickListener onClickListenerButtonClicked = new OnClickListener() {
@Override
public void onClick(View view) {
int iTag = (Integer) view.getTag();
switch (iTag) {
case TAG_BTN_SET_PIN:
AlertDialog.Builder builder = new AlertDialog.Builder(
PinCodeActivity.this);
builder.setMessage(
getResources().getString(R.string.dialog_pin_confirmation)
+ " " +txtPin.getText().toString() + " "
+ getResources().getString(R.string.dialog_pin_confirmation_end))
.setPositiveButton(getResources().getString(R.string.yes), dialogClickListener)
.setNegativeButton(getResources().getString(R.string.no), dialogClickListener).show();
break;
default:
break;
int viewTag = (Integer) view.getTag();
switch (viewTag) {
case TAG_BTN_SET_PIN:
input = new EditText(PinCodeActivity.this);
alertDialog = CommonDialogUtils
.getAlertDialogWithTwoButtonAndEditView(PinCodeActivity.this,
getResources().getString(
R.string.title_head_confirm_pin)
, getResources().getString(R.string.button_ok),
getResources().getString(
R.string.button_cancel),
dialogClickListener,
dialogClickListener, input);
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
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
savePin();
break;
case DialogInterface.BUTTON_POSITIVE:
savePin();
break;
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
break;
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
break;
}
}
};
public void savePin() {
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();
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), REG_ID);
startActivity(intent);
}else{
Preference.put(context, getResources().getString(R.string.shared_pref_pin),
txtPin.getText().toString().trim());
if (fromActivity != null &&
(fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName()))) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.toast_message_pin_change_success),
Toast.LENGTH_SHORT).show();
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.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.putExtra(getResources().getString(R.string.intent_extra_username), username);
startActivity(intent);
@ -225,29 +254,34 @@ public class PinCodeActivity extends Activity {
btnPin.setEnabled(false);
}
}
@SuppressLint("NewApi")
public void enableNewPINSubmitIfReady() {
boolean isReady = false;
SharedPreferences mainPref = this.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
SharedPreferences mainPref =
this.getSharedPreferences(getResources().getString(R.string.shared_pref_package),
Context.MODE_PRIVATE);
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);
}else{
} else {
txtPin.setEnabled(false);
}
if (txtPin.getText().toString().trim().length() >= 4 && txtOldPin.getText().toString().trim().length() >= 4) {
if(txtOldPin.getText().toString().trim().equals(pin.trim())){
if (txtPin.getText().toString().trim().length() >= 4 &&
txtOldPin.getText().toString().trim().length() >= 4) {
if (txtOldPin.getText().toString().trim().equals(pin.trim())) {
isReady = true;
}else{
} else {
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) {
btnPin.setBackground(getResources().getDrawable(R.drawable.btn_orange));
btnPin.setTextColor(getResources().getColor(R.color.white));
@ -258,30 +292,30 @@ public class PinCodeActivity extends Activity {
btnPin.setEnabled(false);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && FROM_ACTIVITY != null && FROM_ACTIVITY.equals(AlreadyRegisteredActivity.class.getSimpleName())) {
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), REG_ID);
startActivity(intent);
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);
if (keyCode == KeyEvent.KEYCODE_BACK && fromActivity != null &&
fromActivity.equals(AlreadyRegisteredActivity.class.getSimpleName())) {
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);
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.pin_code, menu);
return true;
}

@ -15,9 +15,9 @@
*/
package org.wso2.cdm.agent;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
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.utils.CommonDialogUtils;
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.ServerUtils;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class RegistrationActivity extends Activity implements APIResultCallBack {
@ -77,7 +73,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
DeviceInfo deviceInfo = new DeviceInfo(RegistrationActivity.this);
JSONObject jsObject = new JSONObject();
String osVersion = "";
SharedPreferences mainPref =
RegistrationActivity.this.getSharedPreferences(RegistrationActivity.this.getResources()
.getString(R.string.shared_pref_package),
@ -86,33 +81,54 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
mainPref.getString(RegistrationActivity.this.getResources()
.getString(R.string.shared_pref_reg_type),
"");
String username =
mainPref.getString(RegistrationActivity.this.getResources()
.getString(R.string.username),
"");
osVersion = deviceInfo.getOsVersion();
try {
jsObject.put("device", deviceInfo.getDevice());
jsObject.put("imei", deviceInfo.getDeviceId());
jsObject.put("imsi", deviceInfo.getIMSINumber());
jsObject.put("model", deviceInfo.getDeviceModel());
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("regid", regId);
requestParams.put("properties", jsObject.toString());
requestParams.put("osversion", osVersion);
requestParams.put("username", username);
requestParams.put("platform", "Android");
requestParams.put("vendor", deviceInfo.getDeviceManufacturer());
requestParams.put("type", type);
requestParams.put("mac", deviceInfo.getMACAddress());
jsObject.put("deviceIdentifier", deviceInfo.getMACAddress());
jsObject.put("description", deviceInfo.getDevice());
jsObject.put("ownership", type);
JSONArray propertiesArray=new JSONArray();
JSONObject property= new JSONObject();
property.put("name", "username");
property.put("value", username);
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "device");
property.put("value", deviceInfo.getDevice());
propertiesArray.put(property);
property= new JSONObject();
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.
if (PhoneState.isNetworkAvailable(context)) {
// Call device registration API.
sendDeviceDetails(requestParams);
// ServerUtils.callSecuredAPI(RegistrationActivity.this,
// CommonUtilities.REGISTER_ENDPOINT,
// CommonUtilities.POST_METHOD, requestParams,
// RegistrationActivity.this,
// CommonUtilities.REGISTER_REQUEST_CODE);
ServerUtils.callSecuredAPI(RegistrationActivity.this,
CommonUtilities.API_SERVER_URL + CommonUtilities.REGISTER_ENDPOINT,
CommonUtilities.POST_METHOD, jsObject,
RegistrationActivity.this,
CommonUtilities.REGISTER_REQUEST_CODE);
} else {
CommonDialogUtils.stopProgressDialog(progressDialog);
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
public boolean onKeyDown(int keyCode, KeyEvent event) {
@ -242,7 +181,7 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
if (result != null) {
responseStatus = result.get(CommonUtilities.STATUS_KEY);
if (responseStatus.equals(CommonUtilities.REGISTERATION_SUCCESSFUL)) {
if (responseStatus.equals(CommonUtilities.REQUEST_SUCCESSFUL)) {
Intent intent =
new Intent(RegistrationActivity.this,
AlreadyRegisteredActivity.class);
@ -261,8 +200,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
registrationFailedOKBtnClickListerner);
alertDialog.show();
} 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),

@ -1,12 +1,12 @@
/**
* 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.
@ -30,6 +30,7 @@ import android.widget.TextView;
import android.widget.Toast;
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.CommonUtilities;
import org.wso2.cdm.agent.utils.Preference;
@ -73,18 +74,23 @@ public class ServerDetails extends Activity {
tvSeverAddress.setVisibility(View.GONE);
evServerIP.setVisibility(View.GONE);
alertDialog =
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(R.string.error_authorization_failed),
getResources().getString(compatibility.getDescriptionResourceID()),
getResources().getString(R.string.button_ok),
onRootedClickListner);
CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,
getResources().getString(
R.string.error_authorization_failed),
getResources().getString(
compatibility
.getDescriptionResourceID()),
getResources().getString(
R.string.button_ok),
onRootedClickListner);
} else {
btnStartRegistration.setVisibility(View.VISIBLE);
evServerIP.setVisibility(View.VISIBLE);
String ipSaved =
Preference.get(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_ip));
regId = Preference.get(context.getApplicationContext(), getResources().getString(R.string.shared_pref_regId));
Preference.get(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_ip));
regId = Preference.get(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_regId));
//check if we have the IP saved previously.
if (ipSaved != null) {
@ -94,23 +100,31 @@ public class ServerDetails extends Activity {
} else {
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
btnStartRegistration.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(ServerDetails.this);
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(evServerIP.getText().toString());
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())
.setPositiveButton(getResources().getString(R.string.yes),
dialogClickListener)
.setNegativeButton(getResources().getString(R.string.no),
dialogClickListener).show();
.setPositiveButton(getResources().getString(R.string.yes),
dialogClickListener)
.setNegativeButton(getResources().getString(R.string.no),
dialogClickListener).show();
}
});
@ -120,7 +134,8 @@ public class ServerDetails extends Activity {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
if (!evServerIP.getText().toString().trim().equals("")) {
CommonUtilities.setServerURL(evServerIP.getText().toString().trim());
CommonUtilities
.setServerURL(evServerIP.getText().toString().trim());
Preference.put(context.getApplicationContext(),
getResources().getString(R.string.shared_pref_ip),
evServerIP.getText().toString().trim());
@ -128,7 +143,8 @@ public class ServerDetails extends Activity {
} else {
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();
}
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() {
Intent intent = new Intent(ServerDetails.this, AuthenticationActivity.class);
@ -169,190 +185,4 @@ public class ServerDetails extends Activity {
context = null;
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;
import java.util.HashMap;
@ -61,16 +76,16 @@ public class APIController implements TokenCallBack {
protected Map<String, String> doInBackground(APIUtilities... params) {
APIUtilities apiUtilities = params[0];
Map<String, String> response_params = null;
Map<String, String> responseParams = null;
try {
String accessToken = token.getAccessToken();
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("User-Agent", "Mozilla/5.0 ( compatible ), Android");
headers.put("Authorization", "Bearer " + accessToken);
response_params = ServerUtilitiesTemp.postData(apiUtilities, headers);
return response_params;
responseParams = ServerApiAccess.postData(apiUtilities, headers);
return responseParams;
} catch (Exception e) {
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;
import java.util.Map;
import org.json.JSONObject;
public class APIUtilities {
private String httpMethod;
private String endPoint;
private Map<String, String> requestParams;
public Map<String, String> getRequestParams() {
private JSONObject requestParams;
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;
}
public void setRequestParams(Map<String, String> requestParams) {
public void setRequestParams(JSONObject requestParams) {
this.requestParams = requestParams;
}
public String getHttpMethod() {

@ -60,14 +60,14 @@ public class AccessTokenHandler extends Activity {
APIUtilities apiUtilities = new APIUtilities();
apiUtilities.setEndPoint(tokenEndPoint);
apiUtilities.setHttpMethod("POST");
apiUtilities.setRequestParams(request_params);
apiUtilities.setRequestParamsMap(request_params);
Map<String, String> headers = new HashMap<String, String>();
String authorizationString = "Basic " + new String(Base64.encodeBase64((clientID + ":" + clientSecret).getBytes()));
headers.put("Authorization", authorizationString);
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");
responseCode = response_params.get("status");
return response;
@ -84,7 +84,7 @@ public class AccessTokenHandler extends Activity {
if (responseCode != null && responseCode.equals("200")) {
JSONObject response = new JSONObject(result);
Log.d("sdf",response.toString());
try{
accessToken = response.getString("access_token");
refreshToken = response.getString("refresh_token");
@ -99,6 +99,7 @@ public class AccessTokenHandler extends Activity {
Editor editor = mainPref.edit();
editor.putString("access_token", accessToken);
editor.putString("refresh_token",refreshToken);
editor.putString("username", username);
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date date = new Date();
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;
import android.annotation.SuppressLint;
@ -52,7 +67,7 @@ public class RefreshTokenHandler {
apiUtilities.setEndPoint(IdentityProxy.getInstance()
.getAccessTokenURL());
apiUtilities.setHttpMethod("POST");
apiUtilities.setRequestParams(request_params);
apiUtilities.setRequestParamsMap(request_params);
Map<String, String> headers = new HashMap<String, String>();
Log.e("proxy",IdentityProxy.clientID + ":" + IdentityProxy.clientSecret);
@ -60,7 +75,7 @@ public class RefreshTokenHandler {
headers.put("Authorization", authorizationString);
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");
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;
import android.content.Context;
import android.util.Log;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
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.HttpPost;
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.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
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.json.JSONObject;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.utils.CommonUtilities;
@ -31,6 +45,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.security.KeyStore;
import java.util.HashMap;
import java.util.Iterator;
@ -40,7 +55,7 @@ import java.util.Map.Entry;
/**
* Handle network communication between SDK and authorization server
*/
public class ServerUtilitiesTemp {
public class ServerApiAccess {
private final static String TAG = "ServerUtilities";
private static boolean isSSLEnable = false;
private static InputStream inputStream;
@ -84,91 +99,93 @@ public class ServerUtilitiesTemp {
public static Map<String, String> postData(APIUtilities apiUtilities, Map<String, String> headers) {
String httpMethod = apiUtilities.getHttpMethod();
String url = apiUtilities.getEndPoint();
Map<String, String> params = apiUtilities.getRequestParams();
Map<String, String> response_params = new HashMap<String, String>();
JSONObject params = apiUtilities.getRequestParams();
Map<String, String> responseParams = new HashMap<String, String>();
HttpClient httpclient = getCertifiedHttpClient();
String payload = buildPayload(params);
if(httpMethod.equals("POST")){
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);
HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod);
byte[] postData = payload.getBytes();
try {
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("status", status);
return response_params;
responseParams.put("response", getResponseBody(response));
responseParams.put("status", status);
return responseParams;
} 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;
responseParams.put("response", "Internal Server Error");
responseParams.put("status", "500");
return responseParams;
}
}else if(httpMethod.equals("PUT")){
HttpPut httpPut = new HttpPut(url);
HttpPut httpPutWithHeaders = (HttpPut)buildHeaders(httpPut,headers,httpMethod);
byte[] putData = payload.getBytes();
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;
}
}
else if(httpMethod.equals("GET")){
// if(payload!=null){
// url = url+"?"+payload;
// }
HttpGet httpGet = new HttpGet(url);
HttpGet httpGetWithHeaders = (HttpGet) buildHeaders(httpGet,headers,httpMethod);
Log.d(TAG,httpGetWithHeaders.toString());
Log.d(TAG,httpGetWithHeaders.toString()+" GET");
try {
HttpResponse response = httpclient.execute(httpGetWithHeaders);
response_params.put("response", getResponseBody(response));
response_params.put("status", String.valueOf(response.getStatusLine().getStatusCode()));
return response_params;
responseParams.put("response", getResponseBody(response));
responseParams.put("status", String.valueOf(response.getStatusLine().getStatusCode()));
return responseParams;
} 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;
responseParams.put("response", "Internal Server Error");
responseParams.put("status", "500");
return responseParams;
}
}else if(httpMethod.equals("Delete")){
if(payload!=null){
url = url+"?"+payload;
}
HttpDelete httpDelete = new HttpDelete(url);
HttpDelete httpDeleteWithHeaders = (HttpDelete) buildHeaders(httpDelete,headers,httpMethod);
Log.d(TAG,httpDeleteWithHeaders.toString());
}
return null;
}
public static Map<String, String> postDataAPI(APIUtilities apiUtilities, Map<String, String> headers) {
String httpMethod = apiUtilities.getHttpMethod();
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 {
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("status", String.valueOf(response.getStatusLine().getStatusCode()));
response_params.put("status", status);
return response_params;
} catch (ClientProtocolException e) {
Log.d(TAG, "ClientProtocolException :"+e.toString());
return null;
} catch (IOException e) {
Log.d(TAG, e.toString());
Log.d(TAG, e.toString());
response_params.put("response", "Internal Server Error");
response_params.put("status", "500");
return response_params;
@ -215,7 +232,7 @@ public class ServerUtilitiesTemp {
HttpEntity entity = null;
try {
entity = response.getEntity();
response_text = _getResponseBody(entity);
response_text = getResponseBodyContent(entity);
} catch (ParseException e) {
Log.d(TAG, e.toString());
} catch (IOException e) {
@ -230,7 +247,7 @@ public class ServerUtilitiesTemp {
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) {
throw new IllegalArgumentException("HTTP entity may not be null");

@ -1,24 +1,23 @@
/*
~ 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.
*/
/**
* 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.util.Map;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Constant;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -27,19 +26,16 @@ import android.util.Log;
public class AlarmReceiver extends BroadcastReceiver {
private static final String DEBUG_TAG = "AlarmReceiver";
Map<String, String> server_res = null;
Context context;
ProcessMessage processMsg = null;
private static final String DEBUG_TAG = "AlarmReceiver";
@Override
public void onReceive(Context context, Intent intent) {
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));
if(mode.trim().toUpperCase().equals("LOCAL")){
ProcessMessage msg=new ProcessMessage(context);
msg.getOperations(null);
}
//if(mode.trim().toUpperCase().equals(Constant.LOCAL)){
MessageProcessor messageProcessor=new MessageProcessor(context);
messageProcessor.getMessages();
//}
}
}

@ -26,20 +26,22 @@ import android.os.SystemClock;
* polls to server based on a predefined to retrieve pending data.
*/
public class LocalNotification {
public static boolean localNoticicationInvoked=false;
public static void startPolling(Context context) {
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();
firstTime += 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);
alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime,
interval, recurringDownload);
if(localNoticicationInvoked==false){
localNoticicationInvoked=true;
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);
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")
@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);
String data_input=data_in;
String code_input = code_in;
Log.e("doTask","code:"+codeIn+"\n"+dataIn);
String dataInput=dataIn;
String codeInput = codeIn;
String notification = "";
String ssid = "";
String password = "";
@ -421,7 +421,7 @@ public class Operation {
JSONArray resultArr= new JSONArray();
JSONObject result= new JSONObject();
if (code_input.equals(CommonUtilities.OPERATION_DEVICE_INFO)) {
if (codeInput.equals(CommonUtilities.OPERATION_DEVICE_INFO)) {
PhoneState phoneState = new PhoneState(context);
JSONObject obj = new JSONObject();
@ -459,7 +459,7 @@ public class Operation {
obj.put("operator", deviceInfo.getNetworkOperatorName());
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
params.put("data", obj.toString());
@ -467,7 +467,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", obj);
Map<String, String> as = new HashMap<String, String>();
@ -500,7 +500,7 @@ public class Operation {
e1.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_DEVICE_LOCATION)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_DEVICE_LOCATION)) {
LocationServices ls = new LocationServices(context);
Log.v("Latitude", ls.getLatitude());
@ -520,10 +520,10 @@ public class Operation {
params.put("data", obj.toString());
//for local notification\
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", obj);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -540,7 +540,7 @@ public class Operation {
e1.printStackTrace();
}
} else if (code_input
} else if (codeInput
.equals(CommonUtilities.OPERATION_GET_APPLICATION_LIST)) {
ArrayList<PInfo> apps = appList.getInstalledApps(false); /*
* false =
@ -572,7 +572,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", jsonArray);
@ -588,7 +588,7 @@ public class Operation {
params.put("status", "200");
//params.put("data", Uri.encode(jsonArray.toString()));
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();
}
} else if (code_input.equals(CommonUtilities.OPERATION_LOCK_DEVICE)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_LOCK_DEVICE)) {
Log.d(TAG, "Locking device now");
try {
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -639,7 +639,7 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_WIPE_DATA)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_WIPE_DATA)) {
Log.d(TAG,
@ -650,10 +650,10 @@ public class Operation {
String pinSaved = mainPref.getString("pin", "");
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
pin = (String) jobj.get("pin");
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
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) {
//ServerUtilities.pushData(params, context);
@ -703,20 +703,20 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_CLEAR_PASSWORD)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_CLEAR_PASSWORD)) {
ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class);
try {
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -745,11 +745,11 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_NOTIFICATION)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_NOTIFICATION)) {
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
if (jobj.get("notification").toString() != null
|| jobj.get("notification").toString().equals("")) {
notification = jobj.get("notification").toString();
@ -762,14 +762,14 @@ public class Operation {
Log.v("Notification", notification);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context);
@ -787,12 +787,12 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_WIFI)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_WIFI)) {
boolean wifistatus = false;
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("ssid")) {
ssid = (String) jobj.get("ssid");
}
@ -804,7 +804,7 @@ public class Operation {
e.printStackTrace();
}
Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
WiFiConfig config = new WiFiConfig(context);
@ -812,7 +812,7 @@ public class Operation {
try {
//for local notification
resultArr.put(result);
result.put("code", code_input);
result.put("code", codeInput);
wifistatus = config.saveWEPConfig(ssid, password);
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;
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("function")
&& jobj.get("function").toString()
.equalsIgnoreCase("enable")) {
@ -863,14 +863,14 @@ public class Operation {
ComponentName cameraAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
String cammode = "Disabled";
@ -904,29 +904,29 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input
} else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION)
|| code_input
|| codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) {
try {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (code_input
if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION)) {
JSONObject jobj = new JSONObject(data_input);
installApplication(jobj, code_input);
} else if (code_input
JSONObject jobj = new JSONObject(dataInput);
installApplication(jobj, codeInput);
} else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_APPLICATION_BUNDLE)) {
JSONArray jArray = null;
jArray = new JSONArray(data_input);
jArray = new JSONArray(dataInput);
for (int i = 0; i < jArray.length(); i++) {
JSONObject appObj = (JSONObject) jArray
.getJSONObject(i);
installApplication(appObj, code_input);
installApplication(appObj, codeInput);
}
}
@ -935,18 +935,18 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input
} else if (codeInput
.equals(CommonUtilities.OPERATION_UNINSTALL_APPLICATION)) {
String packageName = "";
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
packageName = (String) jobj.get("identity");
Log.v("Package Name : ", packageName);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
@ -954,7 +954,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context);
@ -968,13 +968,13 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_ENCRYPT_STORAGE)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_ENCRYPT_STORAGE)) {
boolean encryptFunc = true;
String pass = "";
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("function")
&& jobj.get("function").toString()
.equalsIgnoreCase("encrypt")) {
@ -991,7 +991,7 @@ public class Operation {
ComponentName admin = new ComponentName(context,
WSO2DeviceAdminReceiver.class);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
if (encryptFunc
@ -1020,7 +1020,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (devicePolicyManager.getStorageEncryptionStatus() != devicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED) {
params.put("status", "200");
result.put("status", "true");
@ -1045,19 +1045,19 @@ public class Operation {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_MUTE)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_MUTE)) {
Log.d(TAG, "Muting Device");
try {
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (req_mode == REQUEST_MODE_NORMAL) {
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1079,7 +1079,7 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_TRACK_CALLS)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_TRACK_CALLS)) {
try {
Map<String, String> params = new HashMap<String, String>();
@ -1091,7 +1091,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", new JSONObject(conversations.getCallDetails().toString()));
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1104,7 +1104,7 @@ public class Operation {
// TODO Auto-generated catch block
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_SENT = 2;
JSONObject smsObj = new JSONObject();
@ -1123,7 +1123,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", smsObj);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1136,7 +1136,7 @@ public class Operation {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_DATA_USAGE)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_DATA_USAGE)) {
JSONObject dataObj = new JSONObject();
try {
@ -1152,7 +1152,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", new JSONObject(deviceState.takeDataUsageSnapShot()
.toString()));
@ -1166,7 +1166,7 @@ public class Operation {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_STATUS)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_STATUS)) {
boolean encryptStatus = false;
boolean passCodeStatus = false;
try {
@ -1195,7 +1195,7 @@ public class Operation {
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
params.put("data", dataObj.toString());
@ -1203,7 +1203,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", dataObj);
if (req_mode == REQUEST_MODE_NORMAL) {
@ -1224,26 +1224,26 @@ public class Operation {
e1.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_WEBCLIP)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_WEBCLIP)) {
String appUrl = "";
String title = "";
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
Log.v("WEBCLIP DATA : ", data.toString());
appUrl = (String) jobj.get("identity");
title = (String) jobj.get("title");
Log.v("Web App URL : ", appUrl);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context);
@ -1256,7 +1256,7 @@ public class Operation {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_PASSWORD_POLICY)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_PASSWORD_POLICY)) {
ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class);
@ -1273,8 +1273,8 @@ public class Operation {
try {
result.put("code", code_input);
JSONObject jobj = new JSONObject(data_input);
result.put("code", codeInput);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("maxFailedAttempts")
&& jobj.get("maxFailedAttempts") != null) {
attempts = Integer.parseInt((String) jobj
@ -1356,7 +1356,7 @@ public class Operation {
String policy = mainPref.getString("policy", "");
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
inparams.put("status", "200");
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="";
long timout;
Map<String, String> inparams = new HashMap<String, String>();
@ -1404,8 +1404,8 @@ public class Operation {
JSONParser jp = new JSONParser();
try {
result.put("code", code_input);
JSONObject jobj = new JSONObject(data_input);
result.put("code", codeInput);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("type")
&& jobj.get("type") != null) {
emailtype = (String) jobj
@ -1438,7 +1438,7 @@ public class Operation {
ic_hostname = "";
}
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
inparams.put("status", "200");
result.put("status", "true");
@ -1475,25 +1475,25 @@ public class Operation {
}
}
}else if (code_input
}else if (codeInput
.equals(CommonUtilities.OPERATION_INSTALL_GOOGLE_APP)) {
String packageName = "";
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
packageName = (String) jobj.get("package");
Log.v("Package Name : ", packageName);
Map<String, String> params = new HashMap<String, String>();
params.put("code", code_input);
params.put("code", codeInput);
params.put("msgID", token);
params.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(params, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1509,7 +1509,7 @@ public class Operation {
e.printStackTrace();
}
} else if (code_input
} else if (codeInput
.equals(CommonUtilities.OPERATION_CHANGE_LOCK_CODE)) {
ComponentName demoDeviceAdmin = new ComponentName(context,
WSO2DeviceAdminReceiver.class);
@ -1519,19 +1519,19 @@ public class Operation {
JSONParser jp = new JSONParser();
try {
JSONObject jobj = new JSONObject(data_input);
JSONObject jobj = new JSONObject(dataInput);
if (!jobj.isNull("password")) {
pass = (String) jobj.get("password");
}
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
inparams.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//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>();
try {
params.put("code", code);
@ -1581,7 +1581,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", new JSONObject(bundle_params.toString()));
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
@ -1593,7 +1593,7 @@ public class Operation {
} catch (Exception ex) {
ex.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_POLICY_MONITOR)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_POLICY_MONITOR)) {
JSONArray sendjArray;
JSONObject jobj=null;
try {
@ -1610,7 +1610,7 @@ public class Operation {
}
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));
PolicyTester tester = new PolicyTester(context, sendjArray,
type, policy_token);
@ -1620,19 +1620,19 @@ public class Operation {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (code_input.equals(CommonUtilities.OPERATION_POLICY_REVOKE)) {
} else if (codeInput.equals(CommonUtilities.OPERATION_POLICY_REVOKE)) {
try {
Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
inparams.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(inparams, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1644,19 +1644,19 @@ public class Operation {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else if (code_input.equals(CommonUtilities.OPERATION_ENTERPRISE_WIPE_DATA)) {
}else if (codeInput.equals(CommonUtilities.OPERATION_ENTERPRISE_WIPE_DATA)) {
try {
Map<String, String> inparams = new HashMap<String, String>();
inparams.put("code", code_input);
inparams.put("code", codeInput);
inparams.put("msgID", token);
inparams.put("status", "200");
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
if (mode == CommonUtilities.MESSAGE_MODE_GCM) {
//ServerUtilities.pushData(inparams, context);
} else if (mode == CommonUtilities.MESSAGE_MODE_SMS) {
@ -1674,7 +1674,7 @@ public class Operation {
e.printStackTrace();
}
}
else if (code_input
else if (codeInput
.equals(CommonUtilities.OPERATION_BLACKLIST_APPS)) {
ArrayList<PInfo> apps = appList.getInstalledApps(false); /*
* false =
@ -1692,7 +1692,7 @@ public class Operation {
try{
JSONObject appsObj = new JSONObject(data_input);
JSONObject appsObj = new JSONObject(dataInput);
if (!appsObj.isNull("data")) {
appsObj = (JSONObject) appsObj.get("data");
}
@ -1737,7 +1737,7 @@ public class Operation {
//for local notification
resultArr.put(result);
result.put("status", "true");
result.put("code", code_input);
result.put("code", codeInput);
result.put("data", jsonArray);
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.
~
~ 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.
*/
/**
* 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 org.wso2.cdm.agent.utils.CommonUtilities;
@ -24,7 +24,7 @@ import android.os.Bundle;
import android.telephony.SmsMessage;
public class SMSReceiver extends BroadcastReceiver {
ProcessMessage processMsg = null;
MessageProcessor processMsg = null;
@Override
public void onReceive(Context context, Intent intent) {
@ -54,9 +54,9 @@ public class SMSReceiver extends BroadcastReceiver {
}
}
processMsg = new ProcessMessage(context,
CommonUtilities.MESSAGE_MODE_SMS, fullMessage,
recipient);
// processMsg = new MessageProcessor(context,
// CommonUtilities.MESSAGE_MODE_SMS, fullMessage,
// recipient);
}
} catch (Exception ex) {

@ -1,25 +1,26 @@
/*
~ 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.
*/
/**
* 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.util.HashMap;
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.proxy.APIResultCallBack;
import org.wso2.cdm.agent.utils.CommonUtilities;
@ -48,12 +49,12 @@ public class WSO2DeviceAdminReceiver extends DeviceAdminReceiver implements APIR
String regId="";
Operation operation;
boolean unregState=false;
/** Called when this application is approved to be a device administrator. */
@Override
public void onEnabled(Context context, Intent intent) {
super.onEnabled(context, intent);
String policy;
JSONArray jArray = null;
operation = new Operation(context);
SharedPreferences mainPref = context.getSharedPreferences("com.mdm",
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.commit();
ProcessMessage pm=new ProcessMessage(context);
pm.getOperations(null);
MessageProcessor pm=new MessageProcessor(context);
pm.getMessages();
try {
policy = mainPref.getString("policy", "");
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.LENGTH_LONG).show();
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
.getResources().getString(R.string.shared_pref_regId));
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("regid", regId);
JSONObject requestParams = new JSONObject();
try {
requestParams.put("regid", regId);
} catch (JSONException e) {
e.printStackTrace();
}
ServerUtils.clearAppData(app_context);
ServerUtils.callSecuredAPI(app_context,
CommonUtilities.UNREGISTER_ENDPOINT,

@ -22,30 +22,37 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.widget.EditText;
import android.widget.LinearLayout;
/**
*
* The CommonDialogUtils class contains the all dialog templates.
*
*
*/
public abstract class CommonDialogUtils {
/**
* Return an Alert Dialog with one button.
*
* @param context the Activity which needs this alert dialog
* @param message the message in the alert
* @param positiveBtnLabel the label of the positive button
* @param positiveClickListener the onClickListener of the positive button
* @param context
* the Activity which needs this alert dialog
* @param message
* 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
*/
public static AlertDialog.Builder getAlertDialogWithOneButton(Context context,
String message, String positiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener) {
String message,
String positiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message)
.setPositiveButton(positiveBtnLabel, positiveClickListener);
builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);
return builder;
}
@ -53,99 +60,119 @@ public abstract class CommonDialogUtils {
/**
* Return an Alert Dialog with two buttons.
*
* @param context
* @param context the Activity which needs this alert dialog
* @param message the message in the alert
* @param positiveBtnLabel 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
* @param context
* @param context
* the Activity which needs this alert dialog
* @param message
* the message in the alert
* @param positiveBtnLabel
* 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.
*/
public static AlertDialog.Builder getAlertDialogWithTwoButton(Context context,
String message, String positiveBtnLabel, String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
String message,
String positiveBtnLabel,
String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message)
.setPositiveButton(positiveBtnLabel, positiveClickListener)
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
return builder;
}
/**
* 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) {
AlertDialog.Builder builder = CommonDialogUtils
.getAlertDialogWithOneButton(
context,
context.getResources().getString(R.string.error_network_unavailable),
context.getResources().getString(R.string.button_ok), null);
AlertDialog.Builder builder =
CommonDialogUtils.getAlertDialogWithOneButton(context,
context.getResources()
.getString(R.string.error_network_unavailable),
context.getResources()
.getString(R.string.button_ok),
null);
builder.show();
}
public static AlertDialog.Builder getAlertDialogWithTwoButtonAndTitle(Context context,
String title, String message,
String positiveBtnLabel, String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
String title,
String message,
String positiveBtnLabel,
String negetiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener,
DialogInterface.OnClickListener negativeClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(message)
.setPositiveButton(positiveBtnLabel, positiveClickListener)
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
.setNegativeButton(negetiveBtnLabel, negativeClickListener);
return builder;
}
/**
* Returns an Alert Dialog with one button and title.
*
* @param context the activity which need this alert.
* @param title the alert title
* @param message the alert message
* @param positiveBtnLabel the positive button label
* @param positiveClickListener the positive button listener
* @param context
* the activity which need this alert.
* @param title
* the alert title
* @param message
* the alert message
* @param positiveBtnLabel
* the positive button label
* @param positiveClickListener
* the positive button listener
*
* @return an alert dialog
*/
public static AlertDialog.Builder getAlertDialogWithOneButtonAndTitle(Context context,
String title, String message,
String positiveBtnLabel, DialogInterface.OnClickListener positiveClickListener) {
String title,
String message,
String positiveBtnLabel,
DialogInterface.OnClickListener positiveClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(message)
.setPositiveButton(positiveBtnLabel, positiveClickListener);
builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);
builder.show();
return builder;
}
/**
* Shows the ProgressDialog.
*
* @param context the Activity which needs the ProgressDialog
* @param title the title
* @param message the message
* @param cancelListener the OnCancelListener
* @param context
* the Activity which needs the ProgressDialog
* @param title
* the title
* @param message
* the message
* @param cancelListener
* the OnCancelListener
*/
public static ProgressDialog showPrgressDialog (Context context, String title, String message, OnCancelListener cancelListener) {
ProgressDialog progressDialog = ProgressDialog.show(context,
title,
message, true);
public static ProgressDialog showPrgressDialog(Context context, String title, String message,
OnCancelListener cancelListener) {
ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true);
progressDialog.setCancelable(true);
progressDialog.setOnCancelListener(cancelListener);
return 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_PROTOCOL = "http://";
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_AUTHENTICATION_ENDPOINT="register/authenticate/device";
public static String LICENSE_ENDPOINT = "register/authenticate/device/license";
public static String REGISTER_ENDPOINT = "enrollment/authenticate/device/enroll";
public static String LICENSE_ENDPOINT = "/license/"+API_VERSION;
public static String REGISTER_ENDPOINT = "/enroll/"+API_VERSION;
public static String OAUTH_ENDPOINT = "/oauth2/token";
public static String SENDER_ID_ENDPOINT = "devices/sender_id/";
public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/";
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 + ":"
+ SERVER_PORT + SERVER_APP_ENDPOINT;
+ SERVER_PORT ;
public static String API_SERVER_URL;
public static final String TRUSTSTORE_PASSWORD = "wso2carbon";
@ -86,7 +88,7 @@ public class CommonUtilities {
SERVER_IP = serverIP;
SERVER_URL = SERVER_PROTOCOL + serverIP + ":" + SERVER_PORT
+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_LOCATION = "501A";
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_CLEAR_PASSWORD = "505A";
public static final String OPERATION_NOTIFICATION = "506A";

@ -23,5 +23,8 @@ public class Constant {
public static final String PASSWORD = "password";
public static final String STATUS = "status";
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.wso2.cdm.agent.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ParseException;
import android.util.Log;
@ -54,25 +53,6 @@ public class HTTPConnectorUtils {
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,
Map<String, String> params) {
Map<String, String> response = null;
@ -121,7 +101,6 @@ public class HTTPConnectorUtils {
}
String body = bodyBuilder.toString();
Log.v(TAG, "Posting '" + body + "' to " + url);
byte[] postData = body.getBytes();
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;
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.Entry;
import java.util.Random;
import org.apache.http.HeaderElement;
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.json.JSONObject;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.proxy.APIController;
import org.wso2.cdm.agent.proxy.APIResultCallBack;
@ -40,16 +29,11 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.ParseException;
import android.util.Log;
public class ServerUtils {
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
@ -69,18 +53,13 @@ public class ServerUtils {
* @param requestCode
* the request code
*/
public static void callSecuredAPI(Context context, String endpoint,
String methodType, Map<String, String> requestParams,
public static void callSecuredAPI(Context context, String endpoint,
String methodType, JSONObject requestParams,
APIResultCallBack apiResultCallBack, int requestCode) {
String serverIP = CommonUtilities.getPref(context, context
.getResources().getString(R.string.shared_pref_ip));
String serverURL = CommonUtilities.SERVER_PROTOCOL + serverIP + ":"
+ CommonUtilities.SERVER_PORT
+ CommonUtilities.SERVER_APP_ENDPOINT;
Log.e("",endpoint);
APIUtilities apiUtilities = new APIUtilities();
apiUtilities.setEndPoint(serverURL + endpoint
+ CommonUtilities.API_VERSION);
apiUtilities.setEndPoint(endpoint);
apiUtilities.setHttpMethod(methodType);
if (requestParams != null) {
apiUtilities.setRequestParams(requestParams);

Loading…
Cancel
Save