Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Perera committed Jan 19, 2017
2 parents 0f647bc + e905815 commit 7a50aca
Show file tree
Hide file tree
Showing 31 changed files with 1,438 additions and 250 deletions.
2 changes: 1 addition & 1 deletion client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildscript {


dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Expand Down
6 changes: 4 additions & 2 deletions client/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.0-rc3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.0-rc3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.0-rc3'
compile 'org.bouncycastle:bcprov-jdk16:1.45'
compile 'com.google.code.gson:gson:2.6.2'
compile "com.splunk.mint:mint:5.0.0"
compile 'com.splunk.mint:mint:5.0.0'
}


89 changes: 48 additions & 41 deletions client/client/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
Expand Down Expand Up @@ -43,11 +42,15 @@
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="org.wso2.emm.system.service.permission.ACCESS"/>
<uses-permission android:name="org.wso2.emm.system.service.permission.ACCESS" />

<permission android:name="android.permission.READ_LOGS" />
<permission android:name="org.wso2.emm.agent.permission.ACCESS"
android:protectionLevel="signature"></permission>
<uses-permission android:name="org.wso2.emm.agent.permission.ACCESS"/>
<permission
android:name="org.wso2.emm.agent.permission.ACCESS"
android:protectionLevel="signature" />

<uses-permission android:name="org.wso2.emm.agent.permission.ACCESS" />

<permission
android:name="org.wso2.emm.agent.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
Expand All @@ -67,30 +70,30 @@
<activity
android:name=".RegistrationActivity"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme"></activity>
android:theme="@style/TopBarTheme" />
<activity
android:name=".DisplayDeviceInfoActivity"
android:label="@string/title_activity_display_device_info"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" />
<activity
android:name=".EnableDeviceAdminActivity"
android:excludeFromRecents="true"
android:label="@string/title_activity_display_device_info"
android:screenOrientation="unspecified"
android:excludeFromRecents="true"></activity>
android:screenOrientation="unspecified" />

<receiver
android:name=".services.AgentDeviceAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN"
android:exported="true">
android:exported="true"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<intent-filter>

<!-- This action is required -->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
<action android:name="android.app.action.PROFILE_PROVISIONING_COMPLETE" />
</intent-filter>

<meta-data
android:name="android.app.device_admin"
android:resource="@xml/agent_device_admin"></meta-data>
android:resource="@xml/agent_device_admin" />
</receiver>
<receiver android:name=".services.AlarmReceiver" />
<receiver android:name=".events.EventAlarmReceiver" />
Expand All @@ -116,14 +119,14 @@
</receiver>
<receiver
android:name=".services.NotificationReceiver"
android:exported="false" >
android:exported="false">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver
android:name=".services.SystemServiceResponseReceiver"
android:exported="false" >
android:exported="false">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Expand All @@ -138,25 +141,26 @@
<data android:scheme="package" />
</intent-filter>
</receiver>

<service
android:name=".services.ApplicationManagementService"
android:enabled="true"
android:permission="org.wso2.emm.agent.permission.ACCESS"
android:exported="true" >
android:exported="true"
android:permission="org.wso2.emm.agent.permission.ACCESS">
<intent-filter>
<action android:name="org.wso2.emm.agent.START_SERVICE" />
</intent-filter>
</service>
<service android:name=".services.EnrollmentService"
<service
android:name=".services.EnrollmentService"
android:enabled="true"
android:permission="org.wso2.emm.agent.permission.ACCESS"
android:exported="true">
android:exported="true"
android:permission="org.wso2.emm.agent.permission.ACCESS">
<intent-filter>
<action android:name="org.wso2.emm.agent.enrollment.START_SERVICE" />
</intent-filter>
</service>
<service
android:name=".FCMMessagingService">
<service android:name=".FCMMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Expand All @@ -172,44 +176,44 @@
<activity
android:name=".AlreadyRegisteredActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock"></activity>
android:theme="@style/Theme.Sherlock" />
<activity
android:name=".AuthenticationActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock"
android:windowSoftInputMode="stateUnchanged|adjustPan"></activity>
android:windowSoftInputMode="stateUnchanged|adjustPan" />
<activity
android:name=".AuthenticationErrorActivity"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" />
<activity
android:name=".NotifyActivity"
android:label="@string/title_activity_notify"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" />
<activity
android:name=".ServerDetails"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustPan"></activity>
android:windowSoftInputMode="stateUnchanged|adjustPan" />
<activity
android:name=".PinCodeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustPan"></activity>
android:windowSoftInputMode="stateUnchanged|adjustPan" />
<activity
android:name=".AlertActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Holo.Dialog.NoActionBar"></activity>
android:theme="@android:style/Theme.Holo.Dialog.NoActionBar" />
<activity
android:name=".LockActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_lock"></activity>
android:label="@string/title_activity_lock" />
<!-- Managed Profile Manifest items -->
<activity
android:name=".services.EnableProfileActivity"
android:label="@string/app_name"></activity>
android:label="@string/app_name" />
<activity
android:name=".WorkProfileManager"
android:label="@string/title_activity_notify"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait" />
<activity
android:name=".AgentReceptionActivity"
android:label="WSO2 Agent">
Expand All @@ -223,19 +227,22 @@
android:name=".AppLockActivity"
android:label="@string/title_activity_alert"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

<service
android:name=".services.AppLockService"
android:permission="org.wso2.emm.agent.permission.ACCESS"
android:exported="false" />

<service
android:name=".InstanceIDListenerService">
android:exported="false"
android:permission="org.wso2.emm.agent.permission.ACCESS" />
<service android:name=".InstanceIDListenerService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

<activity android:name=".KioskActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

</activity>
</application>
</manifest>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ protected void onCreate(Bundle savedInstanceState) {
Response androidForWorkCompatibility = state.evaluateAndroidForWorkCompatibility();
manager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
boolean isDeviceActive = Preference.getBoolean(context, Constants.PreferenceFlag.DEVICE_ACTIVE);

if (CommonUtils.isNetworkAvailable(context)) {
if (isDeviceActive || Constants.SKIP_WORK_PROFILE_CREATION) {
skipToEnrollment();
}
if (androidForWorkCompatibility.getCode()) {
if (Constants.DEFAULT_OWNERSHIP == Constants.OWNERSHIP_COSU) {
skipToEnrollment();
}else if (androidForWorkCompatibility.getCode()) {
manageAndroidForWorkReceiption();
} else {
skipToEnrollment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.wso2.emm.agent.utils.CommonUtils;
import org.wso2.emm.agent.utils.Constants;
import org.wso2.emm.agent.utils.Preference;
import org.wso2.emm.agent.utils.UserPreference;

import java.util.Map;

Expand Down Expand Up @@ -181,13 +180,15 @@ public void onClick(View view) {
DialogInterface.OnClickListener locationPublishingEnableDisableListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
boolean isEventListeningEnabled = UserPreference.isLoctionPublishingEnabled;
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
UserPreference.isLoctionPublishingEnabled = !isEventListeningEnabled;
boolean isEventListeningEnabled = Preference.getBoolean(context,
Constants.PreferenceFlag.IS_LOCATION_EVENT_PUBLICATION_ENABLED);
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
Preference.putBoolean(context, Constants.PreferenceFlag.IS_LOCATION_EVENT_PUBLICATION_ENABLED,
!isEventListeningEnabled);
dialog.dismiss();
break;
case DialogInterface.BUTTON_NEGATIVE:
break;
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();
break;
}
Expand Down Expand Up @@ -469,7 +470,7 @@ private void showUnregisterDialog() {
*/
private void showEventListeningEnableDisableDialog() {
AlertDialog.Builder alertDialog;
if (!UserPreference.isLoctionPublishingEnabled) {
if (!Preference.getBoolean(context, Constants.PreferenceFlag.IS_LOCATION_EVENT_PUBLICATION_ENABLED)) {
alertDialog = CommonDialogUtils.getAlertDialogWithTwoButtonAndTitle(context,
null,
getResources().getString(R.string.dialog__location_event_listening_enable),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.text.Editable;
Expand All @@ -38,6 +40,7 @@
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockActivity;
Expand Down Expand Up @@ -85,6 +88,7 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
private String username;
private String usernameVal;
private String passwordVal;
private TextView textViewWipeData;
private ProgressDialog progressDialog;
private LinearLayout loginLayout;

Expand Down Expand Up @@ -123,6 +127,35 @@ protected void onCreate(Bundle savedInstanceState) {
loginLayout.setVisibility(View.GONE);
}

if (Constants.DEFAULT_OWNERSHIP == Constants.OWNERSHIP_COSU) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
startLockTask();
}
}

textViewWipeData = (TextView) this.findViewById(R.id.textViewWipeData);
if(Constants.DEFAULT_OWNERSHIP == Constants.OWNERSHIP_COSU && Constants.DISPLAY_WIPE_DEVICE_BUTTON){
textViewWipeData.setVisibility(View.VISIBLE);
textViewWipeData.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
new AlertDialog.Builder(AuthenticationActivity.this)
.setTitle(getString(R.string.app_name))
.setMessage(R.string.wipe_confirmation)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
DevicePolicyManager devicePolicyManager = (DevicePolicyManager)
getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
devicePolicyManager.
wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE |
DevicePolicyManager.WIPE_RESET_PROTECTION_DATA);
}})
.setNegativeButton(android.R.string.no, null)
.show();
}
});
}

etUsername.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
Expand Down
Loading

0 comments on commit 7a50aca

Please sign in to comment.