Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bad957d4
Commit
bad957d4
authored
Sep 13, 2016
by
Dan Rubel
Committed by
GitHub
Sep 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused methods (#5837)
cleanup
https://github.com/flutter/flutter/issues/5789
parent
157ffaac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
119 deletions
+0
-119
adb.dart
packages/flutter_tools/lib/src/android/adb.dart
+0
-69
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+0
-50
No files found.
packages/flutter_tools/lib/src/android/adb.dart
View file @
bad957d4
...
...
@@ -19,8 +19,6 @@ class Adb {
final
String
adbPath
;
final
Map
<
String
,
String
>
_idToNameCache
=
<
String
,
String
>{};
bool
exists
()
{
try
{
runCheckedSync
(<
String
>[
adbPath
,
'version'
]);
...
...
@@ -74,73 +72,6 @@ class Adb {
).
toList
();
}
/// Listen to device activations and deactivations via the adb server's
/// 'track-devices' command. Call cancel on the returned stream to stop
/// listening.
Stream
<
List
<
AdbDevice
>>
trackDevices
()
{
StreamController
<
List
<
AdbDevice
>>
controller
;
Socket
socket
;
bool
isFirstNotification
=
true
;
controller
=
new
StreamController
<
List
<
AdbDevice
>>(
onListen:
()
async
{
socket
=
await
Socket
.
connect
(
InternetAddress
.
LOOPBACK_IP_V4
,
adbServerPort
);
printTrace
(
'--> host:track-devices'
);
socket
.
add
(
_createAdbRequest
(
'host:track-devices'
));
socket
.
listen
((
List
<
int
>
data
)
async
{
String
stringResult
=
new
String
.
fromCharCodes
(
data
);
printTrace
(
'<--
${stringResult.trim()}
'
);
_AdbServerResponse
response
=
new
_AdbServerResponse
(
stringResult
,
noStatus:
!
isFirstNotification
);
String
devicesText
=
response
.
message
.
trim
();
isFirstNotification
=
false
;
if
(
devicesText
.
isEmpty
)
{
controller
.
add
(<
AdbDevice
>[]);
}
else
{
List
<
AdbDevice
>
devices
=
devicesText
.
split
(
'
\n
'
).
map
((
String
deviceInfo
)
{
return
new
AdbDevice
(
deviceInfo
);
}).
where
((
AdbDevice
device
)
{
// Filter unauthorized devices - we can't connect to them.
return
!
device
.
isUnauthorized
&&
!
device
.
isOffline
;
}).
toList
();
await
_populateDeviceNames
(
devices
);
controller
.
add
(
devices
);
}
});
socket
.
done
.
then
((
_
)
=>
controller
.
close
());
},
onCancel:
()
=>
socket
?.
destroy
()
);
return
controller
.
stream
;
}
Future
<
Null
>
_populateDeviceNames
(
List
<
AdbDevice
>
devices
)
async
{
for
(
AdbDevice
device
in
devices
)
{
if
(
device
.
modelID
==
null
)
{
// If we don't have a name of a device in our cache, call `device -l` to populate it.
if
(
_idToNameCache
[
device
.
id
]
==
null
)
await
_populateDeviceCache
();
// Set the device name from the cached name. Adb device notifications only
// have IDs, not names. We get the name by calling `listDevices()`.
device
.
modelID
=
_idToNameCache
[
device
.
id
];
}
}
}
Future
<
Null
>
_populateDeviceCache
()
async
{
List
<
AdbDevice
>
devices
=
await
listDevices
();
for
(
AdbDevice
device
in
devices
)
_idToNameCache
[
device
.
id
]
=
device
.
modelID
;
}
Future
<
String
>
_sendAdbServerCommand
(
String
command
)
async
{
Socket
socket
=
await
Socket
.
connect
(
InternetAddress
.
LOOPBACK_IP_V4
,
adbServerPort
);
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
bad957d4
...
...
@@ -222,56 +222,6 @@ class SimControl {
return
getDevices
().
where
((
SimDevice
device
)
=>
device
.
isBooted
).
toList
();
}
StreamController
<
List
<
SimDevice
>>
_trackDevicesControler
;
/// Listens to changes in the set of connected devices. The implementation
/// currently uses polling. Callers should be careful to call cancel() on any
/// stream subscription when finished.
///
/// TODO(devoncarew): We could investigate using the usbmuxd protocol directly.
Stream
<
List
<
SimDevice
>>
trackDevices
()
{
if
(
_trackDevicesControler
==
null
)
{
Timer
timer
;
Set
<
String
>
deviceIds
=
new
Set
<
String
>();
_trackDevicesControler
=
new
StreamController
<
List
<
SimDevice
>>.
broadcast
(
onListen:
()
{
timer
=
new
Timer
.
periodic
(
new
Duration
(
seconds:
4
),
(
Timer
timer
)
{
List
<
SimDevice
>
devices
=
getConnectedDevices
();
if
(
_updateDeviceIds
(
devices
,
deviceIds
))
_trackDevicesControler
.
add
(
devices
);
});
},
onCancel:
()
{
timer
?.
cancel
();
deviceIds
.
clear
();
}
);
}
return
_trackDevicesControler
.
stream
;
}
/// Update the cached set of device IDs and return whether there were any changes.
bool
_updateDeviceIds
(
List
<
SimDevice
>
devices
,
Set
<
String
>
deviceIds
)
{
Set
<
String
>
newIds
=
new
Set
<
String
>.
from
(
devices
.
map
((
SimDevice
device
)
=>
device
.
udid
));
bool
changed
=
false
;
for
(
String
id
in
newIds
)
{
if
(!
deviceIds
.
contains
(
id
))
changed
=
true
;
}
for
(
String
id
in
deviceIds
)
{
if
(!
newIds
.
contains
(
id
))
changed
=
true
;
}
deviceIds
.
clear
();
deviceIds
.
addAll
(
newIds
);
return
changed
;
}
bool
_isAnyConnected
()
=>
getConnectedDevices
().
isNotEmpty
;
bool
isInstalled
(
String
appId
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment