Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
6f57a339
Commit
6f57a339
authored
8 years ago
by
Ashutosh Joshi
Committed by
Android (Google) Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add logging to ContextHubService."
parents
cfdfd997
1d94181f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/core/java/com/android/server/location/ContextHubService.java
+20
-7
20 additions, 7 deletions
...e/java/com/android/server/location/ContextHubService.java
with
20 additions
and
7 deletions
services/core/java/com/android/server/location/ContextHubService.java
+
20
−
7
View file @
6f57a339
...
...
@@ -93,6 +93,8 @@ public class ContextHubService extends IContextHubService.Stub {
public
int
registerCallback
(
IContextHubCallback
callback
)
throws
RemoteException
{
checkPermissions
();
mCallbacksList
.
register
(
callback
);
Log
.
d
(
TAG
,
"Added callback, total callbacks "
+
mCallbacksList
.
getRegisteredCallbackCount
());
return
0
;
}
...
...
@@ -101,6 +103,7 @@ public class ContextHubService extends IContextHubService.Stub {
checkPermissions
();
int
[]
returnArray
=
new
int
[
mContextHubInfo
.
length
];
Log
.
d
(
TAG
,
"System supports "
+
returnArray
.
length
+
" hubs"
);
for
(
int
i
=
0
;
i
<
returnArray
.
length
;
++
i
)
{
returnArray
[
i
]
=
i
;
Log
.
d
(
TAG
,
String
.
format
(
"Hub %s is mapped to %d"
,
...
...
@@ -114,6 +117,7 @@ public class ContextHubService extends IContextHubService.Stub {
public
ContextHubInfo
getContextHubInfo
(
int
contextHubHandle
)
throws
RemoteException
{
checkPermissions
();
if
(!(
contextHubHandle
>=
0
&&
contextHubHandle
<
mContextHubInfo
.
length
))
{
Log
.
e
(
TAG
,
"Invalid context hub handle "
+
contextHubHandle
);
return
null
;
// null means fail
}
...
...
@@ -129,6 +133,7 @@ public class ContextHubService extends IContextHubService.Stub {
return
-
1
;
}
if
(
app
==
null
)
{
Log
.
e
(
TAG
,
"Invalid null app"
);
return
-
1
;
}
...
...
@@ -158,6 +163,7 @@ public class ContextHubService extends IContextHubService.Stub {
checkPermissions
();
NanoAppInstanceInfo
info
=
mNanoAppHash
.
get
(
nanoAppInstanceHandle
);
if
(
info
==
null
)
{
Log
.
e
(
TAG
,
"Cannot find app with handle "
+
nanoAppInstanceHandle
);
return
-
1
;
//means failed
}
...
...
@@ -171,6 +177,7 @@ public class ContextHubService extends IContextHubService.Stub {
byte
msg
[]
=
new
byte
[
0
];
if
(
nativeSendMessage
(
msgHeader
,
msg
)
!=
0
)
{
Log
.
e
(
TAG
,
"native send message fails"
);
return
-
1
;
}
...
...
@@ -187,6 +194,7 @@ public class ContextHubService extends IContextHubService.Stub {
if
(
mNanoAppHash
.
containsKey
(
nanoAppInstanceHandle
))
{
return
mNanoAppHash
.
get
(
nanoAppInstanceHandle
);
}
else
{
Log
.
e
(
TAG
,
"Could not find nanoApp with handle "
+
nanoAppInstanceHandle
);
return
null
;
}
}
...
...
@@ -209,6 +217,7 @@ public class ContextHubService extends IContextHubService.Stub {
retArray
[
i
]
=
foundInstances
.
get
(
i
).
intValue
();
}
Log
.
w
(
TAG
,
"Found "
+
retArray
.
length
+
" apps on hub handle "
+
hubHandle
);
return
retArray
;
}
...
...
@@ -265,22 +274,26 @@ public class ContextHubService extends IContextHubService.Stub {
if
(
header
==
null
||
data
==
null
||
header
.
length
<
MSG_HEADER_SIZE
)
{
return
-
1
;
}
int
callbacksCount
=
mCallbacksList
.
beginBroadcast
();
int
msgType
=
header
[
HEADER_FIELD_MSG_TYPE
];
int
msgVersion
=
header
[
HEADER_FIELD_MSG_VERSION
];
int
hubHandle
=
header
[
HEADER_FIELD_HUB_HANDLE
];
int
appInstance
=
header
[
HEADER_FIELD_APP_INSTANCE
];
Log
.
d
(
TAG
,
"Sending message "
+
msgType
+
" version "
+
msgVersion
+
" from hubHandle "
+
hubHandle
+
", appInstance "
+
appInstance
+
", callBackCount "
+
callbacksCount
);
if
(
callbacksCount
<
1
)
{
Log
.
v
(
TAG
,
"No message callbacks registered."
);
return
0
;
}
ContextHubMessage
msg
=
new
ContextHubMessage
(
header
[
HEADER_FIELD_MSG_TYPE
],
header
[
HEADER_FIELD_MSG_VERSION
],
data
);
ContextHubMessage
msg
=
new
ContextHubMessage
(
msgType
,
msgVersion
,
data
);
for
(
int
i
=
0
;
i
<
callbacksCount
;
++
i
)
{
IContextHubCallback
callback
=
mCallbacksList
.
getBroadcastItem
(
i
);
try
{
callback
.
onMessageReceipt
(
header
[
HEADER_FIELD_HUB_HANDLE
],
header
[
HEADER_FIELD_APP_INSTANCE
],
msg
);
callback
.
onMessageReceipt
(
hubHandle
,
appInstance
,
msg
);
}
catch
(
RemoteException
e
)
{
Log
.
i
(
TAG
,
"Exception ("
+
e
+
") calling remote callback ("
+
callback
+
")."
);
continue
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment