OSDN Git Service

Relax APF version check in ApfGenerator
authorBernie Innocenti <codewiz@google.com>
Fri, 30 Mar 2018 04:08:26 +0000 (13:08 +0900)
committerBernie Innocenti <codewiz@google.com>
Fri, 30 Mar 2018 06:14:39 +0000 (06:14 +0000)
Instead of requiring an *exact* version, we now require a minimum
version. This is necessary if we wish to upgrade the APF interpreter in
vendor firmware independently of the framework code. Adding new opcodes
without changing the semantics of the old ones is always possible and
usually easy, so we can at least have a backwards-compatibility horizon
wider than a single version.

Bug: 36221302
Bug: 73804303
Change-Id: I4f1ed661afb2ede193188eb8086fbf2a8b45b33d
Test: Change extracted from aosp/647079 and tested there
(cherry picked from commit d6bf7ffea788f5753be48a487a2a3b34951dfcb8)

services/net/java/android/net/apf/ApfGenerator.java

index d41fbce..ca8f727 100644 (file)
@@ -367,7 +367,7 @@ public class ApfGenerator {
      */
     public boolean setApfVersion(int version) {
         // This version number syncs up with APF_VERSION in hardware/google/apf/apf_interpreter.h
-        return version == 2;
+        return version >= 2;
     }
 
     private void addInstruction(Instruction instruction) {