Here are the key points about lint and layoutopt from the document:
- lint is a static analysis tool that checks for bugs and optimization opportunities in Android code. It comes pre-installed with Android Studio.
- layoutopt is a tool that optimizes Android layout resources (XML files) to improve performance. It is run automatically by the build system.
- lint checks the code for potential bugs, crashes, security issues and unnecessary or inefficient code. It produces warnings and errors.
- layoutopt analyzes layout files and optimizes them by removing unnecessary attributes, merging rules etc. This makes layout inflation faster.
- Both tools help improve the quality and performance of Android apps without requiring any code changes from the
29. Framerate counter
• Use code on preceding slides in your onDraw() method
• Or if you can change the source
– Set DEBUG_FPS to true in ViewRootImpl.java
– Rebuild frameworks
32. HDMI Capture
• 60 fps recording
• Frame by frame replay
• Requires fast computer
• Requires HDMI output on device
– Xoom
– Galaxy Nexus
• e.g. BlackMagic Intensity Pro
33.
34. High-speed Camera
• Great framerate
– 60 to 1200 fps
• Low resolution & affordable
– e.g. Casio EX-F1 300fps@512x384
• High resolution & (very) expensive
– e.g. RED EPIC-M 300fps@2048x854
• Support all devices
45. public class ViewServerActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewServer.get(this).addWindow(this);
}
@Override
public void onDestroy() {
super.onDestroy();
ViewServer.get(this).removeWindow(this);
}
@Override
public void onResume() {
super.onResume();
ViewServer.get(this).setFocusedWindow(this);
}
}
46. public class ViewServerActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewServer.get(this).addWindow(this);
}
@Override
public void onDestroy() {
super.onDestroy();
ViewServer.get(this).removeWindow(this);
}
@Override
public void onResume() {
super.onResume();
ViewServer.get(this).setFocusedWindow(this);
}
}
47. public class ViewServerActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewServer.get(this).addWindow(this);
}
@Override
public void onDestroy() {
super.onDestroy();
ViewServer.get(this).removeWindow(this);
}
@Override
public void onResume() {
super.onResume();
ViewServer.get(this).setFocusedWindow(this);
}
}
48. public class ViewServerActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewServer.get(this).addWindow(this);
}
@Override
public void onDestroy() {
super.onDestroy();
ViewServer.get(this).removeWindow(this);
}
@Override
public void onResume() {
super.onResume();
ViewServer.get(this).setFocusedWindow(this);
}
}
49. ViewServer
• Single class
– Apache 2.0 license
– Requires INTERNET permission
• API works with
– Activity
– Window
• Only
– for your app
– for debuggable apps
– on user builds
52. lint
$ lint frameworks/base/tests/ChetBugs/TextViewScale
AndroidManifest.xml: Warning: Manifest should specify a minimum API level with <uses-sdk
android:minSdkVersion="?" />; if it really supports all versions of Android set it to 1. [UsesSdk]
res/drawable-hdpi/change_background.png: Warning: The resource R.drawable.change_background appears to be unused
[UnusedResources]
res/drawable-hdpi/gbread.jpg: Warning: The resource R.drawable.gbread appears to be unused [UnusedResources]
res/drawable-hdpi/gbread_sm.jpg: Warning: The resource R.drawable.gbread_sm appears to be unused
[UnusedResources]
res/drawable-hdpi/refresh.png: Warning: The resource R.drawable.refresh appears to be unused [UnusedResources]
res/drawable-hdpi/self_portrait.jpg: Warning: The resource R.drawable.self_portrait appears to be unused
[UnusedResources]
res/drawable-hdpi/gbread.jpg: Warning: The image gbread.jpg varies significantly in its density-independent (dip)
size across the various density versions: drawable-mdpi/gbread.jpg: 2560x1920 dp (2560x1920 px), drawable-hdpi/
gbread.jpg: 1707x1280 dp (2560x1920 px) [IconDipSize]
res/drawable-hdpi/gbread_sm.jpg: Warning: The image gbread_sm.jpg varies significantly in its density-independent
(dip) size across the various density versions: drawable-mdpi/gbread_sm.jpg: 480x640 dp (480x640 px), drawable-
hdpi/gbread_sm.jpg: 320x427 dp (480x640 px) [IconDipSize]
res/drawable-hdpi/self_portrait.jpg: Warning: The image self_portrait.jpg varies significantly in its density-
independent (dip) size across the various density versions: drawable-mdpi/self_portrait.jpg: 671x800 dp (671x800
px), drawable-hdpi/self_portrait.jpg: 447x533 dp (671x800 px) [IconDipSize]
res/drawable-mdpi/gbread.jpg: Warning: The gbread.jpg icon has identical contents in the following configuration
folders: drawable-hdpi, drawable-mdpi [IconDuplicatesConfig]
res/drawable-mdpi/gbread_sm.jpg: Warning: The gbread_sm.jpg icon has identical contents in the following
configuration folders: drawable-hdpi, drawable-mdpi [IconDuplicatesConfig]
res/drawable-mdpi/self_portrait.jpg: Warning: The self_portrait.jpg icon has identical contents in the following
configuration folders: drawable-hdpi, drawable-mdpi [IconDuplicatesConfig]
res/drawable-mdpi/self_portrait.jpg: Warning: The self_portrait.jpg icon has identical contents in the following
configuration folders: drawable-hdpi, drawable-mdpi [IconDuplicatesConfig]
res: Warning: Missing density variation folders in res: drawable-xhdpi [IconMissingDensityFolder]
0 errors, 13 warnings
53. Better yet, use html
$ lint frameworks/base/tests/ChetBugs/TextViewScale --html ~/tmp/lintoutput.html