Note: Setting a flag to 1 enables the flag for debugging, and 0 disables the flag for debugging. I because it automatically creates a log file Cat. Refer to KBA#8399.

goatishspyMobile - Wireless

Dec 10, 2013 (3 years and 9 months ago)

106 views

How to Debug

Android Device Instructions


Things You Will Need

Android Device (that can be enrolled to your server)

USB data cord (to connect device to computer)


Install Android SDK

1.

Go to
http://developer.android.com/sdk/index.html

in your web browser

2.

Click “
Download the Android SDK


3.

Select “
I have read and agree with the above terms and conditions


4.

Check
64
-
bit

and click “
Download the SDK ADT Bundle for Windows


5.

Save (zipped) file onto you
r desktop

Create a File to Debug

1.

Go to
(
Start> All Programs > Accessories > Notepad
)

2.

Create
a doc that contains the flags you want to debug
. Find the list of Afaria debugging flags
and the task they perform at the bottom of this document.

Ex.

LogToFile:1


Heartbeat:1


Heartbeat_5min:1


Transport:1


Session:1


Afaria:1

Note: Setting a flag to 1 enables the flag for debugging, and 0 disables the flag for debugging.
I
recommend you always leave “LogToFile” flag set to 1

because it
au
tomatically creates a log file
“/mnt/sdcard/AfariaLog.dbg” and output additional messages to the Log
Cat
.
Refer to KBA#8399.

3.

Save document as
AfariaLogSettings.dbg

4.

Close notepad

Open Android Debug Monitor

1.

Open the (zipped) file you just downloaded

2.

Click “
Extract all files


3.

In the extracted folder go to (adt
-
bundle
-
windows
-
x86_64
-
20130729
\
sdk
\
tools)

4.

Click on “
monitor.bat
” file,
click run when the pop
-
up menu appears
.

Note: Some Android devices may require you to download a
USB
driver before you can debug, i
f so
download

USB

driver from manufacture’s website.

Debugging Android Device

1.

The Android Debug Monitor should

open, it should

look like this:


2.

Make sure your Android device is already enrolled on your server.

3.

Set your Android device to debugging mode,
you might have to do a Google search on how to
set your device to debug mode.

4.

Using the USB data cable connect your device to your computer.

5.

Your Android device should appear in the “
Device


group in

the Android Debug Monitor:


6.

Click on the device, and th
e LogCat below will start recording logs from your device:


7.

Click “File Explorer”, to display all the files on your device
:


8.

Locate the file mnt>sdcard in the file explorer:


9.

With the sdcard selected click on the “
Push a file onto the device button
”:


10.

Locate the file you create
earlier “
AfariaLogSettings.dbg
”, and open file:


11.

The file is now added to the path mnt>sdcard:


12.

On your Andr
oid device go to (Afaria Client > Connect):


13.

The new file “
AfariaLog.dbg
” has

been automatically generated to

the path
/mnt/sdcard/AfariaLog.dbg. This file contains the logs for the file

(AfariaLogSettings.dbg)
you
created earlier
:


14.

Select the “
AfariaLog.dbg
” file and click the “
Pull a file from device
” button:


15.

Save the file to a location:


16.

Open the file “
Afa
riaLog.dbg
” to view debugging logs.

Note: You may want to copy and paste log in
to a

Word doc
ument

to make it easier to read.




Example of Debugging

1.

Using these log settings:

LogToFile:1

Heartbeat:0

Heartbeat_5min:0

Transport:0

Session:0

Afaria:0

A log
file “
AfariaLog.dbg
” is created with just the basic Afaria logs because “
LogToFile
” is the only flag
enabled. These log settings
generated (







) 8

pages and 1,003 words.

2.

Using these log settings:

LogToFile:1

Heartbeat:0

Heartbeat_5min:0

Transport:1

Session:0

Afaria:0

A log file “
AfariaLog.dbg
” is created with the basic Afaria logs plus “
Transport
” specific logging since

Transport
” is enabled. These log settings
generated (






) 104 pages

and 29,513 words.
A TON OF TRANSPORT LOGG
ING OCCURS WITH THIS FLAG IS ENABLE
D
:


Android Debug Flags

LogToFile



Enables

logging

the log messages to a file on the SD Card in addition to LogCat

Afaria



Very high level logging, generally used for basic logging, so it’s a little of everything

Requests



Logging of requests that go back and forth between the client and server during a session
(Lots of logging when enabled)

Session



High level session related logging, much like the messages on the StatusUI, with some
additional information

Core



Any Core.java related logging.


This is similar to the Afaria component, so a lot gets put in here
that’s pretty general.

Inventory



Inventory related logging

Transport



Transport specific logging, so packets dumps of packets going in and out of the c
lient (A
*
TON
* of logging occurs with this, so disable it unless you really need it)

RequestProcessor



Request Processor logging, which is basically the mechanism that handles requests
that are sent from the server.


Somewhat linked to the Requests compon
ent

Authentication



Authentication related logging, particularly authentication with XComms

C2DM



Google Cloud Messaging logging

Heartbeat



Heartbeat related logging, still used, but is phasing out now that we have Schedules

Heartbeat_5min



Alters the
Heartbeat check interval from being 30 minutes to being 5 minutes

Wifi


Wifi related logging; This is only in relation to base Android Wifi

SMS



SMS related logging, scanning the SMS Inbox, and scanning any messages that come in, this
generally handed ov
er to the Message Component pretty quickly though

ClientProperties



Client Properties are key value pairs that we store on the device, we log all gets/sets
with this component

Nitrodesk



Nitrodesk related logging

Samsung



Samsung related logging

Motorol
a



Motorola related logging

Apps



Application Policy related logging, such as requests that we make for packages/icons/etc.

Bluetooth


Bluetooth related logging, This is only in relation to base Android Bluetooth

Message



Message related logging, GCM/S
MS messages are both sent to this component for
verification and processing

Security



Pretty generic security logging, but generally its anything related to security that is not part of
one of the other components, such as AES Encryption

Enrollment



All
logging that is done as part of initial enrollment

ESD


ESD related logging, currently it’s only in reference to MMEP ESD

SeedData



Logging in relation to processing Seed Data from the server

Command



Command Processor logging, which is basically when w
e get an Outbound command from
the server, we hand it to the Command Processor.

StatusUI



Controls what is logged when on the Status UI, generally messages

AfariaAPI



3
rd

Party API logging, not sure how much logging is done here

UserPrompts



User Promp
t logging, particularly when saving/loading them during enrollment

TEM



Tem logging, pretty basic

TEMDB



Tem Database logging, they tend to store data in a database on the device, and this logs
anything to do with that functionality

LG


LG related
logging

Boot



OnBoot logging, so any actions or logging we do on boot

Remediation



Remediation related logging, such as processing the remediation XML, or the
Remediation Service checking the status on the device

SamsungAccountManager



Samsung Account M
anager is a specific service that handles newer
Samsung devices that we have to wait for the Email application to be opened to get the account ID.

Certificate


Certificate related logging, currently this isn’t used in anything that is visible to customers

Database


Client Database logging

MMEP



MMEP Related logging, particularly in reference to the communications between the base
client and the MMEP, such as binding/unbinding to the service

CertificatesAPI


Certificate API logging, which is actually the

API that we use client side to retrieve
certificates from the Enrollment Server (SCEP, Identity Certificate, etc.)

UserInterface



UserInterface related logging, such as Action Bar (Bar at the top of the client), or other
UI elements that need to do some
kind of logging

Alarm



Alarm Scheduler related logging, we use this to log when we are within the domain of the Alarm
scheduler, which handles scheduling generic events, such as Password Expiration and Remediation
checks.

EnrollmentAPI



Enrollment API related logging, which is basically any time we need to make an HTTP
request to the enrollment server to pull down or send some kind of data

Upgrade



Client Upgrade related logging, we have a client service that triggers on upgrade of th
e client
in case we need to transition anything upon upgrade, and this component handles that.

Schedule



Schedule related logging, such as schedule XML processing and Scheduling of events

Policy



Generic Policy related logging, currently Schedules is the

only policy type in the GetPolicy
payload that comes from the Enrollment Server