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
8486bc11
Commit
8486bc11
authored
13 years ago
by
Svetoslav Ganov
Browse files
Options
Downloads
Patches
Plain Diff
Update to allow passing empty string in a binding.
Change-Id: Ia16bd5dc78da1f5c8e52070d9c0e8431744224e8
parent
6f9d697d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmds/content/src/com/android/commands/content/Content.java
+10
-5
10 additions, 5 deletions
cmds/content/src/com/android/commands/content/Content.java
with
10 additions
and
5 deletions
cmds/content/src/com/android/commands/content/Content.java
+
10
−
5
View file @
8486bc11
...
...
@@ -69,6 +69,7 @@ public class Content {
+
" <COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where:\n"
+
" <TYPE> specifies data type such as:\n"
+
" b - boolean, s - string, i - integer, l - long, f - float, d - double\n"
+
" Note: Omit the value for passing an empty string, e.g column:s:\n"
+
" Example:\n"
+
" # Add \"new_setting\" secure setting with value \"new_value\".\n"
+
" adb shell content insert --uri content://settings/secure --bind name:s:new_setting"
...
...
@@ -245,13 +246,17 @@ public class Content {
if
(
TextUtils
.
isEmpty
(
argument
))
{
throw
new
IllegalArgumentException
(
"Binding not well formed: "
+
argument
);
}
String
[]
binding
=
argument
.
split
(
COLON
);
if
(
binding
.
length
!=
3
)
{
final
int
firstColonIndex
=
argument
.
indexOf
(
COLON
);
if
(
firstColonIndex
<
0
)
{
throw
new
IllegalArgumentException
(
"Binding not well formed: "
+
argument
);
}
String
column
=
binding
[
0
];
String
type
=
binding
[
1
];
String
value
=
binding
[
2
];
final
int
secondColonIndex
=
argument
.
indexOf
(
COLON
,
firstColonIndex
+
1
);
if
(
secondColonIndex
<
0
)
{
throw
new
IllegalArgumentException
(
"Binding not well formed: "
+
argument
);
}
String
column
=
argument
.
substring
(
0
,
firstColonIndex
);
String
type
=
argument
.
substring
(
firstColonIndex
+
1
,
secondColonIndex
);
String
value
=
argument
.
substring
(
secondColonIndex
+
1
);
if
(
TYPE_STRING
.
equals
(
type
))
{
values
.
put
(
column
,
value
);
}
else
if
(
TYPE_BOOLEAN
.
equalsIgnoreCase
(
type
))
{
...
...
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